During all the furore about the stage production of Rita, Sue and Bob Too being cancelled – and then rapidly reinstated – at the Royal Court theatre, it became apparent that some people didn’t find the 1987 film very funny at all. Which struck me as funny (peculiar), because I thought it was hilarious. Though the subject matter isn’t – a married older man begins a torrid and seedy sexual affair with two schoolgirls from a deprived and depressed Bradford council estate – the situations are.

There’s a certain kind of narrative that seems bleak if you’re looking at it from above – but is funny if you’re in it

But then, maybe you have to be in a special place to see the humour, down there with the people in those situations. Maybe there’s a certain kind of narrative that seems bleak and hopeless if you’re looking at it from above but which is funny if you’re in it and among it.

As Ted Bovis was wont to say to Spike in Hi-de-Hi!, the first rule of comedy is reality. Things are funny if they’re true, if we can relate to them. And for me, growing up in a working-class household in the north, Rita, Sue and Bob Too was both true and funny.

It wasn’t alone as a portrayal of working-class life that was only funny because it spoke to those who got the joke. Take Boys from the Blackstuff, Alan Bleasdale’s 1982 TV series about the fortunes and misfortunes of a group of unemployed asphalt layers in Liverpool. The standout performance was from Bernard Hill, as Yosser Hughes. Yosser has been emasculated by joblessness, his wife leaves him, and he is constantly threatened by social services, who want to take his children away. He slides into a nervous breakdown, attempts suicide, and is given to violent outbursts in the form of savage head-butts.

There was nothing funny about Yosser, or his situation. As a 12-year-old watching that, I knew people like Yosser. Unemployment was rampant in my corner of Lancashire; my dad was laid off just before one Christmas. And yet we laughed. We laughed especially hard when, on the brink of despair, Yosser goes into the confessional at his local church to finally overcome his masculinity and seek help. He swallows his pride and tells the priest that he’s desperate. The priest – bored, mischievous, intellectually superior perhaps – encourages Yosser to call him by his name, Daniel Thomas. Yosser does so, and with prompting for yet further familiarity, repeats his anguished plea, shortening the priest’s name.

When Yosser realises that he’s been coaxed into saying “I’m desperate, Dan”, he delivers a solid forehead to the confessional box. When we realised what he’d said, we laughed like drains.

Were we laughing at Yosser? No, because that would have been laughing at ourselves. We were laughing at the situation, at things we could all recognise, that many around us had lived through. Perhaps someone far away to the south, in a bigger house, with a secure job, might not have laughed at Yosser. They might have found it too unutterably bleak to even watch. But we laughed, because otherwise we’d cry, and that wouldn’t have got anybody anywhere, would it?

Perhaps a little later, my English class studied A Kestrel for a Knave, by Barry Hines, and we watched Ken Loach’s 1969 film version, Kes. It tells the story of hopeless case Billy Casper, bullied by his family, his schoolmates, even his teachers, who finds a sliver of redemption in a baby kestrel that he resolves to train. Both book and film are unremittingly sad and desolate in their portrayal of working-class northern life. But I recall, as we watched a jerky VHS video in a darkened room, the gales of laughter from us all – probably at the scene where dirt-poor Billy, last to be picked for school football in his hand-me-down shorts and school shoes in lieu of proper football boots, is relentlessly bullied by Brian Glover’s petulant and childish PE teacher.

Sitting at the back of the darkened classroom I noticed our English teacher – not from round our parish – lean towards a colleague and whisper in despair: “They’re laughing at all the wrong bits.”

Billy Casper; Yosser Hughes; Rita, Sue and Bob – we recognised them all. Sometimes they spoke directly to us, sometimes they actually were us. I don’t want to get all “class warrior” on anybody, but maybe this stuff is only really funny if you’ve lived it, if you’re working-class, and if you’re northern. It’s the vein of humour deployed, to a gentler extent, by Craig Cash, the late, lamented Caroline Aherne, and Henry Normal in The Royle Family.

It is also apparent in The League of Gentlemen, which starts a new run on BBC Two today after a 15-year hiatus. The link between The League and Rita, Sue and Bob Too might not be obvious at first, but it’s there.

Jeremy Dyson, Mark Gatiss, Steve Pemberton and Reece Shearsmith are mining the same seam of black, bleak humour found in lives more ordinary, hopeless and goal-less, forgotten and abandoned. The League exaggerates and parodies, ramps up the ridiculousness and grotesquery, but it’s there all the same.

It’s especially evident in the Royston Vasey job club, where we see course leader Pauline (Pemberton), who has a burning disdain for the “dole scum” who sit around, smoking and reading the racing pages while she tries to offer utterly useless advice for finding employment, and tragic Mickey (Gatiss), a special needs man-child whose chances of thriving in a harsh, brutal world are less than zero.

Though played for laughs, The League is at heart as dreary and remorseless as Rita, Sue and Bob Too, or Boys from the Blackstuff. Programmes we were meant to laugh at – the middle-class sitcoms where people lived in big houses, had steady jobs and poured sherry from decanters on the sideboard – were as fantastical and exotic as American TV to the northern working classes. So is it any surprise that we panned like prospectors for moments of humour in what others may see as social dramas? At least those programmes spoke to us and reflected our lives.

• David Barnett is an arts writer