There was dismay this week in the 8 Out of 10 Cats writing room. Usually, when a bunch of TV writers express genuine, heartfelt horror it's because a runner has presented them with a plate of the wrong flavour muffins. But this time it was about something serious, or almost as serious: the jailing of Matthew Woods. Nineteen years old, and doing three months for making "grossly offensive" comments about an abducted child. On his own Facebook page.

As you might imagine, seeing someone getting a custodial sentence for making jokes, however disgusting and unimaginative they are, didn't exactly play well among people whose job it is to make jokes. As my fellow writer on 10 O'Clock Live, Alan Connor, put it: "If we've really criminalised attempts to gross out your peers with horrible jokes, then every comedy writer in the UK is, for better or worse, going to be in prison before they take their second sip of coffee tomorrow morning."

Everyone I spoke to about Matthew Woods and his beery late-night Facebook posts asked versions of the same question: since when did making sick jokes become a crime? "It seems uncomfortably like an obscenity conviction," said the comic Frankie Boyle. "Millions of horrendous things are said on Twitter every day, how do you police it? Perhaps a better idea would be to police things like direct threats of violence."

In this case, the only actual threats of violence were directed at Woods. As Charlie Brooker said, "Presumably Matthew Woods learned a powerful lesson about the potential consequences of tasteless humour when a 50-strong mob turned up at his house and the police had to arrest him for his own safety. Jailing him on top of that is insane. Sick jokes can upset and offend. Hurriedly formed vigilante mobs can kill. If the state earnestly believes that the former pose a greater threat to social order than the latter, the state is nuts."

The scariest thing about this nutty judgment is its mob logic. The court deemed Woods's jokes a crime under section 127 of the Communications Act 2003, which outlaws "grossly offensive" messages. The chairman of the bench at Chorley magistrates court, Bill Hudson, explained why this resulted in a custodial sentence: "The reason for the sentence is the seriousness of the offence, the public outrage that has been caused."

In other words, the "public outrage" is evidence of the gross offensiveness (which constitutes the crime). The offence caused is proof of the offence. So in a weird way, the people who decide what's grossly offensive (and therefore criminal) are outraged folks such as knee-jerk journalists and the baying vigilante mob.

What's more, according to the Communications Act 2003, those who are grossly offended by the message "need not be the recipients". Just so long as somebody gets to be outraged.

It's a rationale praised by comedy writers the Dawson Bros: "If a joke has offended even one solitary person," they say, "the perpetrator should be jailed without trial. A sketch about a dead parrot will not be funny to someone mourning the passing of a beloved bird. Jail the Monty Python six. A skit about gardening implements will sicken anyone whose relative was impaled on a fork handle. Jail Corbett and send Barker's gravestone to landfill. And a man falling through an open bar hatch will deeply offend the countless people who've lost loved ones to lethal pub mishaps. Jail David Jason. And while you're there, lock up Trigger as an accomplice."

Personally, I find the public declarations of Chairman Hudson, which have been published online, to be "grossly offensive" – does that mean I can press charges under section 127 of the Communications Act 2003? Surely the problem here lies in this dragnet of a term, "grossly offensive".

This is the sort of dangerously vague legislation that the comedian Liam Mullone describes as "fluffy-headed fascism", which, he says, is, "largely the legacy of Blair's tenure. In a few short years our government doubled the statute books with a slew of ill thought-out, open-ended, catch-all laws which had relatively little to do with protecting the people and more to do with Blair's penchant for social engineering. They seemed to disregard everything we've learned about the sanctity of individual liberty."

Never mind liberty, where does it leave comedy? Says Mullone: "It's going to be impossible to do or say anything remotely interesting in a climate where the mob mentality – 'it upsets me so don't say it' – is backed by policemen in the wings."

Part of anyone's job who works in comedy is to scratch about on the fringes of bad taste. It's no wonder comedians are getting nervous.

No one I spoke to about Matthew Woods was in a mad rush to defend him as a person – "he's obviously a massive prick" as one producer put it – but everyone thought it bizarre that this massive prick was behind bars as a result of the things he wrote. Things like: "Who in their right mind would abduct a ginger kid?" and the frankly baffling: "Could have just started the greatest Facebook argument ever. April Fools, Who Wants Maddie?"

No one is defending him on the grounds that he's funny. He's not. But he deserves our support just as much as Paul Chambers, whose notorious airport-bomb quip was met with a great chorus of righteous retweets from furious defenders of free speech. That chorus seems to have gone a bit quiet, now that it comes to rallying behind "comments of a sexually explicit nature" regarding a missing five-year-old.

The writer and broadcaster Victoria Coren warns: "It's easy for us peaceable western liberals to make a fuss when a likeable musician or poet is censored in a faraway country. But when it's a revolting moron being offensive in our own country, the point is still the same: you can't start sending people to prison for saying something you don't like."

Turns out, in Chorley at least, you can.