Most modern audiences will be unfamiliar with Oscar Levant, a concert pianist and composer who became a film actor, quiz-show panelist and talk-show host in the 1940s, ’50s and ’60s. He was also a public wit whose pointed barbs about Hollywood (“I knew Doris Day before she was a virgin”) and his own mental health challenges made him a popular figure in the early days of TV — and far, far ahead of his time. (He would have drawn a huge following on social media.)

Levant is brought to full, complicated and glorious life in Doug Wright’s new one-act drama “Good Night, Oscar,” which opened Tuesday at Broadway’s Belasco Theatre. At its center is a tour de force performance by Sean Hayes, who channels his comic energy into the various physical tics of Levant’s physical and mental condition as a man who admitted his battles with OCD, manic depression and prescription pill addiction long before that was the norm for celebrities. “There’s a fine line between genius and insanity. I have erased this line,” Levant famously said — and Hayes embodies those distinctions in ways that are astonishing to behold.

Wright sets up a plausible, though fictionalized premise for the evening: It’s 1958 and Tonight Show host Jack Paar (a solid Ben Rappaport) has tapped Levant as his first guest for a week of shows broadcast from the West Coast. He soon learns that Levant’s wife, June (Emily Bergl, in a savvy turn) has sprung her husband from the psychiatric ward at Mount Sinai for a four-hour pass so he can appear on the show. NBC President Bob Sarnoff (Peter Grosz) is alarmed about Paar’s choice of guest given how Levant had a reputation for controversial remarks about politics, religion and his own neuroses that did not always play well in Middle America. The format allows Levant to deliver a kind of greatest-hits medley of some of his wittiest bon mots — as well as offering Hayes the chance to act out the physical manifestations of OCD, drug withdrawal and then the sudden highs that come with a quick hit of Demerol.

Wright also tosses in a young uber-fan of a page (Alex Wyse) to provide additional exposition about Levant’s claim to fame — as well as the ghost of George Gershwin (John Zdrojeski), a mentor and friend whose monumental genius both inspired and daunted Levant to the point of crippling anxiety about his own not-inconsiderable skills.

Lisa Peterson’s direction smoothly manages the transitions, and she’s aided by Rachel Hauck’s sets that re-create the mid-century wood-paneled look of network offices, Emilio Sosa’s period costumes (from June’s Beverly Hills-ready outfit to Levant’s rumpled and ill-fitting suit) as well as lighting designers Carolina Ortiz Herrera and Ben Stanton’s ingenious use of blues to mimic Levant’s chemically-induced flashbacks.

But the show saves its greatest gambit for the end, when Hayes’ Levant sits down to a grand piano and plays Gershwin’s “Rhapsody in Blue” (with a taped orchestra accompanying him toward the end). Hayes, who trained as a pianist in his youth, delivers a note-perfect rendition of this tricky piece, his fingers flying across the keyboard and his whole body reflecting a concentration, enthusiasm and torturedness. It’s an astonishing scene that itself embodies the contradictions of this nearly forgotten artist.