"Great minds discuss ideas; Average minds discuss events; Small minds discuss people."
I have previously written here that non-believers should not allow believers to use ad hominem arguments and that non-believers should be careful about debating believers. Implicit in those posts is the idea that non-believers also should not use ad hominems or even come close to using them. Attack the idea and not the person.
The problem with debating believers, however, is that most of them can't tell the difference! That's why they can be very dangerous. Especially if you win the argument. Their religion is completely intertwined with their egos. Attacks on their religion, especially successful ones, can enrage them.
This is why they are so quick to resort to ad hominem arguments. They can't discuss religion (or many other things) objectively. They take your thoughts about religion as a personal attack, so they strike back in a way that they think is "in kind" with the way you are attacking. Part of the problem is that they don't have any sound or valid arguments to make and have little choice but to resort to such things--except to admit they are wrong. In addition, this inability to come up with a good argument makes them feel inadequate, thus making the issue a matter of personal pride for them even if it weren't already.
Once they do use an ad hominem attack, call them on it. Tell them what it is and why it is not a valid argument. You can say something like:
"Now you're just being insulting."
As I suggested before, you might add:
"If you have proof or logic, let's hear it."
Then, in most cases, you should just break off the discussion. Once something becomes a matter of pride for a person who is completely driven by the needs of his ego--so much so that everything he sees or hears is interpreted in light of the needs of his ego--then you can't possibly make any headway and can only hurt your cause.
If it is safe to do so, you can follow it up with:
"I have read that when a person resorts to personal attacks in a debate it means he knows he has lost the debate."
"You are making it personal now, which I guess means you don't have any good arguments."
These last two have to be delivered right away or not at all and delivered in a relatively collegial way, as if you were gently pointing out a flaw or failure to a colleague or even a friend. Don't wait until their emotions have become heated if you can help it.
The important thing to remember is that this inability to separate their religion from their egos is another sign that religion is often simply a form of Narcissistic Personality Disorder. The more quickly the religious person shows signs of this, the more likely it is that you are dealing with someone who is not stable and who will also possess psychopathic traits. Thus, it is a valuable early warning that you may be dealing with a believer who could become a danger to you.