Although many speakers would no doubt rate both as, to some degree or other, 'acceptable', I would slightly disagree with Dave that both can be called "correct".
The use of an objective-case pronoun here is, at best, for informal use only, since removal of what then ought to be a mere optional participial (teasing my hair) would yield a non-sentence
*Who would have guessed that him would make such a difference?
The only fully "correct" form for the pronoun here is in fact the possessive case, irrespective of our 'focus' on the person vs. the action:
Who would have guessed that his teasing my hair would make such a difference?
, the -ing phrase thereby becoming a gerund and standing as the true - and, of course, obligatory - subject of the subordinate clause.
Moreover, while conceding that the use of objective-case pronouns as a substitute for the possessive in such constructions is extremely widespread in daily speech, I would reject the argument that some genuine semantic distinction in terms of emphasis/focus is thereby achieved.
Who would have guessed that his teasing my hair would make such a difference?
can be distinguished just as well by vocal tone from
Who would have guessed that his teasing my hair would make such a difference?
as by any dubious morphological change!