As entertaining as such conversations can be,it's dangerous to your job health if they happen at work.I always try to suddenly get too busy with some work when such conversations get started. I have one rule I follow at work,your name doesn't come out of my mouth unless it's to say something bland that's work related "Bill was asigned to do that" or to say something positive "Susan did a terrific job on those posters". If I have an issue or complaint with your performance ,professional respect dictates that info belongs first in the ear of the person I'm unhappy with and if that fails in the ear of the supervisor in charge.
As for friends in social situations.. you don't badmouth my friends in front of me.. period