NEW YORK (AP) — Douglas Carter Beane’s new play “The Nance” opens with Nathan Lane hungrily looking around an [auth] automat. It is 1937 in New York and he’s not there for the food.

Lane, who portrays a lonely burlesque performer in the play that opened Monday at the Lyceum Theater, is there on his off-hours to try to pick up a man — any man, really. It’s an assignation that city officials frown upon in these closeted times and so everyone has to be careful or they’ll end up in jail.

He spots an attractive younger man and offers him part of his sandwich. “I warn you, it is ham,” Lane’s character says, always ready with a quip. “I’m an actor, that might be considered an act of cannibalism.”

This furtive dance at the automat — dangerous and funny and with its own careful rules — is a taste of a more quiet and thoughtful labor of love for a playwright lately more associated with such splashy shows as “Rodgers + Hammerstein’s Cinderella” and “Sister Act.” Directed with subtlety and tenderness by Jack O’Brien, this is a bittersweet tale of repression and rebellion wrapped up in a valentine to a lost theatrical art form.

Beane’s hero here is a “nance” — a show business term for a stereotypically camp homosexual man — who is struggling both with his own identity and frustration at society’s hypocrisy toward homosexuality amid the dying days of burlesque, which had to follow its own strict rules and patterns — pasties and G-strings on the girls — or its performers also risked official condemnation.

The two stories Beane is telling are brilliantly connected by John Lee Beatty’s rotating set, which takes viewers both backstage and in the seats at a burlesque theater, as well as inside the apartment of Lane’s Chauncey Miles. It is another way of exploring the gulf between public and private.

Lane as the tortured soul at the play’s heart is magnificent — showing sides that are charming, witty, savage, self-destructive and yearning. While many nances were actually straight men, Miles is a gay man pretending to be an over-the-top, ridiculously limp-wristed fairy, (“kind of like a Negro doing blackface,” he says) which makes him sometimes sick to his stomach.

Love comes into his life — or at least it seems that way — when a younger, down-on-his luck man called Ned shows up at the automat and gets picked up by Miles, a complexly written character who staunchly defends the Republican Party despite the cultural crackdowns.

A relationship blooms and Miles even invites the man to live with him and share his stage. Unfortunately, Ned, played with very little shading by Jonny Orsini, is never a true equal to Miles — either on the page or stage — and so their relationship never seems deep or truthful.

The rest of the cast — Jenni Barber, Andrea Burns, Cady Huffman, Mylinda Hull, Geoffrey Allen Murphy and Lewis J. Stadlen — play various small parts at the burlesque theater, whether performers or stagehands. Huffman stands out as a Communist sympathizing dancer who good-naturedly butts head with Miles but ultimately ends up just as jaded as her friend.

The show alternates from dealing with politics — Miles’ defense of burlesque and free expression during a monologue in court is a highlight — and the intensely personal, as when our hero must confront why he can’t seem to remain monogamous, needing to chase after “boys with a touch of lavender.”

One of the best scenes is toward the end when a self-loathing Miles returns to the stage in full-on drag. He has dropped the nance act and is playing an old whore named Hortense. Lane is still funny but seems thoroughly and unbearably broken. It is heartbreaking.