In a paid gig it's easier - the landlord/organiser can put the person out. In a session in a pub they've as much right as you to be there and they may well think that you're ruining their evening by singing or playing as much as they're being a pain to you. Maybe if it's a major problem the answer is to find another pub or another evening.On a lighter note Albe Donnelly of a 70's band Supercharge was getting cries of 'rubbish' from a heckler and deadpanned 'we don't do requests!'.
On another occassion Stan Arnold just looked at a heckler and said 'I'm sure I know your face...' and 10 minutes later when talking about Bury on a wet Friday evening 'Only place open was the sex shop...that's where I know you from!' by the time he got to asking if it blew all right the heckler was long gone!
All the best
Steve