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.
In my personal opinion, you should use 'him' and here's why:
"If I were a cup, where would I hide?"
Now, the subject is thinking of a hypothetical situation where he is a cup. Now, if that sentence was spoken from the perspective of the cup, then it would be:
"If I were a cup, where would it hide?"
Not that the gender has to do anything with an animate and inanimate object, but I think it works out in the same way as this example.
Also, the stress is on the improbability of the situation. "If he were...", but he is not a 'she' at the point of reference. So the subject is still a 'he', so you should refer the subject as a "him".
Note: This may not be a perfect explanation, but for me, the comparison works.
Best Answer
This is an ongoing awkwardness in the English language. It still sounds awkward to many of us to use the third person plural to mean a third person masculine-or-feminine singular. However, I think it will eventually be adopted, simply because saying "him or her", "he or she", "him- or herself" (I prefer to use the hyphen) is even more awkward.
Note that in the original sentence "him or her self" is incorrect (hard to notice because the line break occurs there). Herself is one word.