Opening the book…
Whatever you let pass once becomes the ceiling of acceptable behaviour, and everyone present now knows the rule better than any policy document could tell them. Waiting until later means the group has already concluded you were fine with it. Naming the behaviour rather than the person leaves the door open for them to change without having to defend their identity.
Interrupt with something short and specific: "We don't talk about people who aren't in the room." No speech, no sarcasm, no laugh to soften it. Then move the conversation on so the moment isn't a spectacle, and follow up privately with the person who did it and the person it landed on.
If the cruelty is coming from someone with power over the target, deal with it separately so the target doesn't pay for your intervention. And if you have misread affection between old colleagues as an attack, check privately with the person on the receiving end rather than escalating for them.