I was expecting another Miranda.

I think everyone was. Miranda has been a success therefore commissioners want more Miranda, other Mirandas, Mirandas everywhere.

But it turned out that Heading Out (BBC Two, Tuesday, 10pm), the new sitcom from Sue Perkins, was not like Miranda at all. It did not have Miranda's perky, happy, essentially empty approach to life – it had darkness. It opened with a seriously ill pet cat being put down and then wrapped in a bin liner. Which is good. The point of comedy is to lighten dark places but to do that, it needs to go to dark places.

I just didn't expect it from Sue Perkins. Perkins is nice. She has a flippity-floppity fringe, clever glasses and a sensible university education. She also does a show about cakes and yet here she is doing black humour about a vet who has just put down a pet cat.

But was it funny? Yes, it was. There was a particularly good line when someone asked Perkins why she was carrying the dead cat round with her. "I like to swing it round a room to see how big it is," she said.

And there were other lines like that – lovely little lines for anyone who likes the way a sentence sounds when all the words are beautifully arranged from one end to the other, like ornaments on a mantel. Like this one, when Perkins was embarrassed: "I'm just going to wait for my face to dip from Alex Ferguson to a normal raspberry."

Or this one from Perkins's friend: "What's up? Make it something new. I don't have the energy to feign interest in the same old crap."

But was there something else going on with this show, something more important than the comedy?

I don't want to exaggerate the relevance of this programme – it's just a sitcom, after all – but the main character is a lesbian and that feels like progress. For so long, gay characters in British comedies performed only one function, which was to turn up and deliver a catty line or two (there were a few exceptions in American shows such as Ellen and Will & Grace). The British characters were never real. Now we have this sitcom with a lesbian lead character.

But the clever thing is it doesn't make the mistake of the other big current gay sitcom, Channel 4's The New Normal, which is set in a world where all gay people are wonderful and all straight people are horrible, as if The New Normal feels it has to right television's gay/straight imbalance all at once.

Heading Out reflects a much more realistic world in which some of the gay characters live up to the stereotypes. So there is a prissy gay man obsessed with cleaning because in real life there are lots of prissy gay men obsessed with cleaning.

But as well as this, Sue Perkins can do old-fashioned comedy too. Like the moment when she storms out of the gym and then has to come back for her dog. And all you can hear is the squeak-squeak of her trainers on the polished wooden gym floor. It is anti-pompous and pro-funny and a very promising, welcome development in sitcom.