In Sarah Ruhl and Todd Almond's musical Melancholy Play, a character describes suffering as a brand of citizenship. Yet to others in the play, it's practically a religion. This is a story about people who revel in sadness—and all fall in love with the one woman who fits their vision of exquisite gloom.

There's probably an alternate universe where Melancholy Play is the theatrical equivalent of a dirge. Yet Third Rail Repertory Theatre has successfully captured the script's peculiar combination of mocking wit and profound tenderness. You may not have asked for an alternately deadpan and sincere meditation on melancholy, joy and depression, but after seeing this production, it seems like the most obvious thing in the world.

Directed by Rebecca Lingafelter, Melancholy Play focuses on four characters—a tailor named Frank (Nick Ferrucci), a therapist named Lorenzo (Michael Hanna), a hairdresser named Frances (Ithica Tell) and a nurse named Joan (Kerry Ryan)—who fall for Tilly (Leah Yorkston), who works in a bank. Her vacant expression and downbeat murmurings ("do you ever feel melancholy in the afternoon, sweeping up hair that's no longer on anyone's head?" she asks Frances) are like catnip to the melancholics, who spend the first act vying to be her partner in misery.

The second act charts a new emotional course. Invigorated by her recent birthday party, Tilly has become happy—cackling, sticking-her-legs-in-the-air happy. Baffled and repulsed, her suitors struggle to comprehend her transformation, while singing with a chamber orchestra that features cello, piano, viola and violin.

At the risk of stating the obvious, Melancholy Play is weird—that's part of its charm. The actors are hilariously convincing as people who fetishize anguish (it's a treat to hear Ferrucci solemnly declare, "I wanted to bathe in her sadness like a bath"), and Jenny Ampersand's scene design amplifies the comically depressing vibes by blanketing the theater with blood-red drapes and fussy-looking doilies.

Yet delectably dark wit isn't the only reason to see Melancholy Play. Ruhl and Almond are aware their characters cling to a romanticized idea of sadness (hence Joan's response after meeting Tilly: "I have this sexy, sad feeling I've never had before"). Their fealty to that idea is challenged when they learn that one of their number is suffering from depression, a state represented by characters transforming into almonds (literally). Seeing so many people trapped by a pain that is oppressive, not glamorous, spurs the characters to embrace a higher calling—to look beyond the dogma of worshipping a single emotional state and awaken to the emotional needs of the people around them.

It's easy to sit back and chuckle at the epically mopey musings in Melancholy Play's songs (including Tilly's signature lament: "Everyone is always coming and going/And I wish they would stay in one place/Like at the bank/They get their money/And then they leave"). But the play's most potent scene is one in which Tilly insists that when someone is suffering from depression, it isn't enough to ask how they are or seek medical attention—you need to physically go to them. It's part of a social contract, she argues.

Because those words are delivered in the gloriously goofy, pseudo-ethereal voice that Yorkston uses for Tilly, it may take a moment for some audiences to realize that Tilly is serious. But she is, and so are Ruhl and Almond. The most beautiful thing about Melancholy Play is that while it is funny, it isn't a joke.

SEE IT: Melancholy Play: A Chamber Musical is at CoHo Theatre, 2257 NW Raleigh St., thirdrailrep.org. 7:30 pm Wednesday-Saturday, 2 pm Sunday, through Dec. 22. $25-$46.