I just had something like this happen yesterday. Milder than the previous examples but still made me
The guy who sits across from me (Joe) was having an impromptu meeting at his desk with two other guys (one I know really well - Ken, one I barely know but seems mild-mannered - Sam). This is common practice in our office culture, but I couldn't help hearing their entire conversation though I was not really listening.
At one point Joe says something that wasn't work-specific and casually included a term that is descriptive of a group of people, but now considered derogatory when used the way he used it. I half-turned around and gave him a flat look but didn't say anything. I wanted him to know I could hear him and didn't approve. Joe is known for trying too hard to act like a "cool kid" (he's mid-40s), though I hadn't heard him say something blatantly offensive before.
But then Sam surprised me by adding a comment ALSO using that term, like he was trying to match Joe's tone. So then I turned all the way around and said, as icily as I could, "That's an interesting choice of words." As I was turning back, Joe kind of muttered "Sorry" and they eventually picked up their conversation again.
Sometimes I feel like the PC police. I've called out relatives and some close friends on using racial stereotypes or derogatory terms (like the above situation). One person actually told me she felt she couldn't be honest about how she felt about <group of people> because I would get mad at her. I can't help how someone feels, but I definitely don't want to listen to stuff like "All X people are <stereotype>."
Personally I vote for making it known you won't tolerate that kind of language, whether it's a sharp look, a quiet comment like "Please don't use that term again", or a fuller explanation of its offensiveness to you (and presumably others). I think the choice of which depends on the situation and the speaker, and how effective you think each response might be.