Jim O’Heir, aka bumbling Jerry Gergich from NBC’s “Parks and Recreation,” takes a darker path as the star of “Middle Man,” an award-winning black comedy opening Friday in select AMC theatres nationwide (including the AMC Empire 25 on West 42nd St.) and airing this fall on Netflix.

In the movie, O’Heir plays Lenny Freeman (below), a schlubby mama’s boy with a dead-end accounting job who dreams of being a stand-up comic. “Lenny lives with his mother, who raised him on Burns and Allen and Abbott and Costello,” says O’Heir. “When she passes away, as an homage to her, he goes on a journey to become a standup comic but he’s the most unfunny man to ever walk the planet.” Lenny’s troubles start when he picks up a psychotic hitchhiker (Andrew J. West).

‘I knew I needed to play this role 10 years ago when it was first presented to me.’ - Jim O’Heir

“Terrible things start happening — bodies start piling up — and Lenny becomes funny by talking about what’s happening to him,” says O’Heir. “People think he’s doing a bit, but he’s just telling the truth. To me, it’s really about what price someone will pay for fame.”

O’Heir says he welcomed the chance to tackle a different sort of role in “Middle Man,” written and directed by Ned Crowley and co-starring Josh McDermitt (“The Walking Dead”) and Anne Dudek (“Mad Men”). “I hate to use the word ‘labeled,’ but I’m usually the big, funny, wacky guy, the neighbor or the sad-sack of the office, like Jerry [in “Parks and Recreation],” says O’Heir, who recently won a Daytime Emmy for his guest-starring role in “The Bold and the Beautiful.”

“I knew I needed to play this role 10 years ago when it was first presented to me,” he says. “Ned’s been a friend of mine for 30 years … and then ‘Parks and Rec’ came along and it gave me some heat.”

O’Heir and Crowley will co-host a Q&A Tuesday at the AMC Empire 25; on Wednesday, O’Heir guests on “Late Night with Seth Meyers.”

“I’m just proud of every aspect of this film,” he says.