A "Jack the lad" factory worker was sacked after bringing an offensive mug to work, poking fun at a mate's ex-girlfriend.
Craig Reed, 41, thought he was just having a laugh when he gave the cartoon mug to a colleague at a fertiliser plant which had a 95% male workforce.
The mug had cartoon owls on it and speech bubbles describing the workmate's ex as, among other things, a "lanky bitch".
But when a female consultant spotted it in a cupboard when she went to make a cup of tea, she read it as an "offensive misogynist message directed at me".
Mr Reed's bosses accepted she was not the target, but the company had a zero-tolerance policy on offensive language, and dismissed him.
Viewed as a joker and "man about town" by colleagues, he had an unblemished 20-year record of working at the CF Fertilisers plant in Billingham.
Banter at the factory could be "close to the knuckle", but Mr Reed was described as a "grafter" with a "heart of gold" who "never upset anyone".
But now an employment tribunal has wrecked his hopes of compensation after ruling that his sacking was fair.
The consultant, who had been brought in to advise on restructuring, was a tall woman, and thought the mug referred to her.
She took a photo of it, and after she complained to management a disciplinary investigation began.
Mr Reed said he was "sincerely sorry" and told investigators "I wouldn't want to upset anyone. It will never happen again."
His boss said he was "a bit of a Jack the lad" and a "good guy", but the company had a zero tolerance approach to bringing offensive material to work.
He said that sacking well-liked Mr Reed was one of the hardest decisions he had ever taken in his career.
Ruling on his unfair dismissal claim, Judge Jennifer Wade said: "This is a case about humour at work that has gone wrong."
Mr Reed had worked for American-owned CF Fertilisers UK Limited since he was an apprentice and was "very hard working and willing to help".
"It is clear to me that some employers would have taken a different approach" and given him a final written warning, she added.
"Some employers would have listened to those very remorseful statements...and concluded that he would never do such a thing again.
"He was the subject of a zero-tolerance approach in circumstances where he would never have wished to be.
"Certainly, he was very upset by it, when measured against his previous good character and record."
But his boss had "carefully considered" what to do, and sacking Mr Reed was within the range of reasonable responses.
Judge Wade concluded that the company "acted reasonably in treating his conduct in bringing to work the offensive mug as sufficient reason for his dismissal".