Don't engage a heckler unless you have to.
This is the simplest rule of all, which Dane Cook flagrantly ignores. A rude comment on MySpace? Were any entertainer to take the time to personally respond to all of their online hate, they would have little time to do anything else (unless they were Dane Cook, who would just be chilling, regardless). Restrict your energies to those who are heckling you in front of a large audience.
Turn the crowd against the heckler.
This is accomplished by subtly placing yourself and the crowd together as one group, and positioning the heckler as an outsider who is assaulting both of you. This is key. Don't allow the crowd to merely be a neutral observer, refereeing the spat. If that happens, they may well decide the heckler was right, because—let's face it—you are a jerk. The crowd would never indict itself at the same time as you, though, so be buddies with the mob.
Always be funnier than your heckler.
Goes without saying. If your name is Dane Cook, this could be a problem. If your heckler is funnier than you, just call security and sit quietly.
Don't let your mouth write checks your ass can't cash.
That heckler that just called you a pussy: Can you really kick his ass? If not, don't say so. That literary critic who said you can't string a sentence together: Is he a far better writer than you? Then don't call him a hack. That commenter that pointed out your idiotic error: Are you really going to execute him? (Yes, you are). Always be sure you can back up what you say. Humiliation compounds at a geometric rate.
[pic via ohnotheydidnt]