What role does the pronoun play in the sentence? If it's a subject, it should be in the subjective case. If it's an object, it should be in the objective case.
As I parse this sentence, "him" is the object of the preposition "but". The prepositional phrase "but him" modifies the pronoun "nobody". The nominative phrase "nobody but him" is the subject of the clause. "Was" is the verb. "Present" is a predicate adjective.
However, there is an alternate view. The word "but" can also be a conjunction. As a conjunction, it would join the subject "nobody" with the subject "he". As a subject, "he" takes the subjective case.
Since both options are grammatically possible, which should we prefer?
I could say that, in my dialect, the first sounds more natural. That may be true, but it isn't very helpful.
There is a version of this sentence such that "but" must be a preposition: "Nobody was present but him." To my ear, this version means the same thing as the original. For that reason, I recommend treating this instance of "but" as a preposition, and treating "him" as the object of a preposition.
Your version is correct. My opinion is talk
should be used with to
unless the subject is not an expression.
Eddie smiled as Will talked to him and his wife.
Eddie smiled as Will talked with decency.
Best Answer
In short, the answer is no. But there is a longer explanation.
Consider the following from a purely syntactical point of view:
In technically formal and traditional English, the correct answer to "Who is it?" is "It's I" or "It's she."
However, idiomatically, that's not what many people say.
To be understood in practice, the correct answer is "It's me" or "It's her."
Also consider the following from a purely syntactical point of view:
In technically formal and traditional English, the correct construction should be "His parents and he are in his family."
However, that's completely wrong from an idiomatic point of view. Nobody would ever say that and think it was correct. (They would say "His parents and him are in his family.")
Now let's look at your actual example:
Can you replace him with he and be correct?
Only in a strictly formal and traditional sense. In fact, from that specific perspective, it would be the only correct word to use.
But, idiomatically, it would be wrong. It's not what's commonly used, nor what would be understood by most people. And modern guidelines of usage have shifted to accommodate the new usage.
So again, you would not want to do that.