Back during my brief stint in stand-up, I took a course with a professional comedian with over twenty years in the business. For one entire class, we spent time working on material for the moments when shit goes wrong. Stuff like a waitress dropping the checks, or just dropping anything, or people wandering in and out and causing a scene or anything that would disrupt a set.
We spent an ample amount of time on hecklers because everyone, from the top of the top to the open mic people, get heckled. Usually by a person who wishes they were the person on stage getting all of the attention.
All of these comics dispense with hecklers in their own magical way but George Carlin gets right down to the heart of the moment but wishing death on relatives not even in the room. He was a true master.