I cannot imagine many situations where shouting ad hominem! would give you better chances at convincing the audience you were right, than for example explaining why you think the other person is misrepresenting your argument unfairly. If you play this the right way you might be even able to get the person opposite towards some realization.
Humour is a good way, but another good way is pretending not to know things, have them explain things to you — all while naively asking the painful questions. This can be as simple as asking Why? till they come to the point where they suddenly have to talk about the base of their believes:
A: I hate foreigners
B: Why?
A: Because they are stealing our jobs!
B: Why are they doing that?
A: Because they cannot get jobs in their home country.
B: Why do you think that is?
A: I think $Nationality is just lazier than us.
At this point you can go on, or you could ask why he is afraid of them stealing his job when they are lazy.
But the point is: this provides more insight to the emotion based thinking of the other side than any discussion where you were going against the guy from the start could have done.Of course it is not always the right move to start a discussion with someone just because they are saying something that is wrong. Just start a discussion if you are willing to follow through.