Somehow, swimming laps inspired the makings of a new musical mystery thriller – a twisted tale, set in a cemetery, involving fire and death.

Moments of clarity would arise in between the methodical rhythm of slicing through water and gasping for air. After half an hour or so, the playwright would get out of the pool and enter the fresh ideas into his iPhone. Then, it was back to his New York City apartment to work under the careful watch of his two cats.

Don’t be fooled.

Stephen Dolginoff’s play doesn’t resemble anything warm and fuzzy.

To describe the story of “Flames,” it’s more like Alfred Hitchcock meets Edgar Allan Poe.

“I tend to somehow gravitate toward the darker content,” he said. “As happy as a story I want to tell, (the music) lends itself toward darker stories or at least more serious ones.”

Lamb Arts Regional Theatre will be the first to produce “Flames” as part of the non-profit’s annual fundraising event. The “Baaa-nefit,” taking place Oct. 17-19, features food, a cash bar, live and silent auctions and the world premiere of Dolginoff’s new production.

It will be open to the public Oct. 24 to Nov. 3.

Just in time for all things spooky, the play shows what you don’t know will come back to haunt you.

The plot: One year ago, Edmund died. He left behind his fiancée, Meredith, and best friend, Eric. Questions still linger about his death and the terrible crime he committed. Why did he do it? Where is the money? The only thing for certain is that some things refuse to stay buried.

The three-person cast includes Jessica Wheeler, Josh Case and Matt Rixner.

“It’s very rare that a theater gets an opportunity to get an absolutely brand new script,” Director Russ Wooley said. “This is our 34th season, and we’ve only done two (world premieres).”

Both were created by Dolginoff.

Even though the Kansas City native has never been to show at Lamb, he follows their performances each year.

“They have one of the most eclectic seasons and sophisticated audiences that theaters in New York would envy,” he said, citing Lamb’s mix of shows from Broadway classics to youth musicals, from family friendly comedies to his own dark and edgy plays.

The working relationship between the New York-based writer and Lamb began with “Thrill Me: The Leopold and Loeb Story.” The musical drama explores the chilling true story of thrill killers Richard Leopold and Nathan Loeb, who murdered a 14-year-old boy in an attempt to commit the perfect crime.

Dolginoff never thought about starring in his own creation, but as a fluke in 2005, he ended up playing the part of Leopold off-Broadway.

“I wish every writer could have the chance to be in their own show,” he said. “You learn a lot. After the terror of it was over, it was a lot of fun.

“I don’t think there’s a part for me in ‘Flames,’ though.”

When Lamb decided to produce the show six years ago, Dolginoff simply sent an email of thanks to Wooley and kept in touch ever since. He even met up with Wooley and his wife, Diana, when they were in New York City. At the time, he was completing “Panic,” the story behind Orson Welles’ infamous radio broadcast of “The War of the Worlds.”

Lamb claimed the world premiere of that production in 2009.

“Cut to earlier this year,” Dolginoff said, “when I had finished my new musical thriller, ‘Flames,’ the first person I sent it to was Russ. I wanted his opinion.”

Unlike the other two plays, “Flames” isn’t written around historical events.

“I had nothing to work from but my own imagination,” he said.

Some of that inspiration struck while he was in the pool. Going for a swim is something Dolginoff does every morning unless he’s out of town or sick. He wanted to end the play a certain way but couldn’t figure out how to make it work.

Nothing came to him during his daily swim.

Just for fun, he went to see the 40th anniversary film screening of “Cabaret” with four of the stars present, joined by Turner Classic Movies host Robert Osborne.

“It was such a great night,” he said. “It hit me. The end of ‘Flames.’ Nothing in the movie gave me a clue. It was just the experience of being there. I was able to come up with one final surprise.”