Photo: NBC/Sergei Bachlakov/NBC

The first season of NBC’s true-crime parody Trial & Error was funny and strange, but not quite fully baked. A comedy about a newbie New York lawyer who moves to a small town in South Carolina to defend a man accused of murder, Trial & Error season one was a little like the first half of the movie Clue: a murder mystery that’s building toward farce, but hasn’t yet breached the outer limits of absurdity. But the season was buoyed by John Lithgow’s great, gently haywire performance as the accused murderous poet Larry Henderson.

Thrillingly, the second season has moved far beyond Trial & Error’s promising but undercooked beginnings. It’s leapt willy-nilly into the second half of Clue, where everyone rushes around in bonkers mode and the entire production leans precariously off-balance. You think it’ll either right itself so the story can go on, or get so silly that the whole thing just collapses. But in the first five episodes provided to critics ahead of Thursday night’s premiere, Trial & Error just keeps spinning itself faster and faster into dizzy, delightful mayhem, with no collapse on the horizon.

The key to Trial & Error season two, subtitled Lady Killer, is its new accused murderess: Lavinia Peck-Foster, played by Kristin Chenoweth. It’s set in the same small town, it features the same lawyer (Josh Segal, played by Nicholas D’Agosto), the same prosecutor (Carol Anne Keane, played by Jayma Mays), and the same troupe of barely functional investigators. But the crime and the person at the center of the story are different, and this season’s accused criminal is Chenoweth’s purring, conscience-free, cheerfully demented wealthy widow.

If the only good thing about this season were Chenoweth’s performance, it’d still be worth watching. It’d probably be worth it just for her costumes and accessories — in the first episode alone, she wears a turban, carries a cigarette holder that’s longer than her forearm, and dons a lavender floral ruffled swim cap that’s somehow also a mockery of the idea of swim caps. The swim cap is especially a throwback, fussy and demur, and also so marvelously extra that it almost pulls focus from the scene. Which is a decent summary of Chenoweth’s character: self-obsessed and eye-catching and utterly cuckoo. Lavinia is sociopathic, existing in a world only barely resembling reality. There’s a brief scene in a later episode where she rapidly gathers an entire formal meal inside a tablecloth and stuffs the whole bundle out a window; I watched it four times.

Chenoweth has described her inspiration for Lavinia Peck-Foster as a combination of Hannibal Lecter, Lisa Vanderpump, Madeline Kahn, and Carol Burnett, with a dash of Dolly Parton. It seems implausible for them all to be there, but they are, and with her gloriously unhinged glamour at the core of Trial & Error, all the other pieces click into place in a way they just didn’t quite manage in the first season.

The season-two premiere establishes Lavinia Peck-Foster as a beloved figure in the town of East Peck, the deranged, charming matriarch who runs the whole place. Once you understand that East Peck is a town that worships this completely bananas woman, the whole silly production makes so much more sense. Of course the first season’s Judge Horsedich would be replaced by a judge whose name is even sillier, and who speaks in an high-pitched squeaking voice that the entire town can understand but lawyer Josh cannot. Of course the town has ancient laws about how women who drive have to be preceded by a man on foot waving flags and yelling, “Woman driver!” All of the characters from season one who seemed like too much — Sherri Shepherd as the face-blind head researcher Anne Flatch, Steven Boyer as loyal, moronic investigator Dwayne Reed — make sense when the town of East Peck is recast as a galaxy of madness that orbits around Lavinia.

She’s also a more effective foil for Josh, the defense attorney who’s meant to be the relatively sane outsider figure. Where his primary reaction to Lithgow’s Larry Henderson was exasperation and confusion, Lavinia’s high-key charm provides a more complicated, multifaceted problem, and many of the best moments of the season come when Josh offers a Jim–from–The Office reaction to Lavinia’s most over-the-top flourishes. D’Agosto is good at those moments, and Josh’s attempt to stay grounded inside the Mel Brooks-ian world of East Peck also strengthens the side stories, especially his quasi-romantic relationship and rivalry with Carol.

However, there is one piece of season two that feels like a missed opportunity, at least in the first five episodes. Like American Vandal before it, Trial & Error tries to curl back on itself by writing a true-crime narrative into the show itself: A reporter with a mic shows up in East Peck, in the process of producing MTowne, an S-Town knockoff about Lavinia’s case. I kept waiting for that, too, to fall into East Peck’s absurdity, but it gets played too straight and ends up seeming disposable.

As befits any true-crime mockumentary, Trial & Error: Lady Killer is full of plot. There are alibis, timelines, and evidence — at one point, in a truly Clue-esque moment, the bruised imprint of a clock smashed in someone’s face provides a time of death — and as with any good farce, the plot is simultaneously all-important and also totally irrelevant. Lavinia must be brought to justice or be acquitted of the crime in the end, and Trial & Error has machinations aplenty for both outcomes. But for all of the twists and slapstick pratfalls, all that really matters is the magnetism of Lavinia, her dastardly deeds, and that truly fantastic swim cap.