They could have just said to you "that is inappropriate, next time there will be consequences" or something. No need to sack you over a joke.
Yes, 40 years ago we got away with saying a lot of things we probably shouldn't have. Still, there needs to be a bit of leniency in these things.