It really is a brilliant metaphor. The beauty is, you don’t need to try to reason with them anymore (which is an impossible task anyway) just constantly talk over them saying “Gammon!” loudly in a variety of amusing voices and watch as they slowly get more and more gammon-like before having a heart attack and keeling over.
I don’t think it is racist – you could definitely have a gammon-of-colour (it’s more about the way they act, really, than how they look) but no examples really spring to mind. Certainly I have encounted female gammon before so it isn’t sexist either!