Actually, I never understood how this works. (Non-native speaker here, so don't shoot.) By the same token, shouldn't you say "I am better at math than he"? And doesn't that sound awful? Doesn't "I am better at math than him" sound better?
I believe that it's quite acceptable to use the accusative/dative case ("him" instead of "he", "me" instead of "I" and so on) after a preposition. In this case, the pronoun ("him") is the object of the preposition ("than"). For comparison, it is definitely correct to say "for him" and "after them" and "before her", right? Is there any reason why the preposition "than" shouldn't be used in the same way?
Now, saying "I am better than math than he" is no less grammatically correct - though I still believe it sounds awful. It just assumes a different syntax. In this case, the object of the preposition "than" is an entire relative clause ("he is (good at math)"), most of which is omitted. So the pronoun is rightly in the nominative case, because it's now the subject of the omitted verb ("is").
Or at least, that's how I understand it. Am I wrong? And if so, why? I'd love to learn.
EDIT - Here's wikipedia's take. I still don't understand why "than him" is wrong. Or if it IS wrong, for that matter.