“She is gone, but she used to be mine.”

I don’t think anyone, hearing that lyric from Waitress, could escape feeling a rush of sadness and exhilaration. Sadness at the line’s multiple meanings; exhilaration in the velvet, heartfelt beauty Jessie Mueller imbues “She Used To Be Mine” with, in the breath-bating 11 o’clock number from this gem of a show. Waitress, which opened tonight at the Brooks Atkinson Theatre, is the rare musical adaptation that’s as much of a sweetheart as its source, Adrienne Shelly’s 2007 independent film.

Waitress/Jessie MuellerI’ve cheated here a bit by attaching a video of the song as it’s sung by its composer/lyricist Sara Bareilles, here making her Broadway debut in collaboration with book writer Jessie Nelson (who produced Stepmom and The Story of Us, and produced Danny Collins). But you’ll get a good sense not only of the number’s stand-alone power, but of its centrality to the story Waitress tells. Many a pop song writer has attempted this duality, but few achieve it; pop songs tend to be self-contained while theater songs need to reveal character and move the action forward.

Mueller, who won the Tony Award for her portrayal of songwriter/singer Carole King in Beautiful, returns with another spectacular performance in the title role as Jenna, eking out a living in a roadside diner in the South where she has achieved local fame as a baker of transcendent pies named according to her state of mind, which ranges in any given  day, hour, minute from whimsical to mordant. Jenna (The Americans‘ Keri Russell in the film) is pregnant by her abusive terrorist of a husband Earl (Nick Cordero, Tony nominee for Bullets Over Broadway). She finds some solace in the friendship of the other two waitresses, salty Becky (Keala Settle) and naïve Dawn; even in the gruffness of their putative boss, the cook Cal (Eric Anderson, not the singer/songwriter).

Waitress/Jessie Mueller, Drew GehlingLife brightens somewhat when Jenna starts an affair with the married ob/gyn Dr. Pomatter (the appealing Drew Gehling, in the role created by Castle himself, Nathan Fillion). She also has come under the quietly protective visage of the diner’s cranky owner Joe (gracefully underplayed by the veteran actor Dakin Matthews, taking a role that marked one of Andy Griffith’s final screen appearances). There’s also Ogie (Christopher Fitzgerald), Dawn’s dorkily persistent suitor.

These are, on the one hand, the ingredients of a sit-com, each character a well-defined type and a hermetic environment that lends itself to quotidien comedies and dramas. Shelly, who was a ballsy, entrepreneurial actress-cum-writer, director and producer, had more in mind. The subject of spousal abuse is rarely treated in such a setting, and it was given a dimension of complexity that made Earl no less a monster for his childlike neediness. The affair, too, isn’t treated in typical manner (despite the sexual gymnastics both the movie and the show indulge in for comic effect).

To all of that Bareilles, Nelson, director Diane Paulus and choreographer Lorin Latarro remain faithful, sacrificing little of the film’s nuance while only occasionally spilling over into sitcomland silliness. The positives far outnumber the negatives. Jenna is a heroine of the moment, taking control of her life and offering no apologies for her choices, even — or especially — the arguable ones. Mueller has a girl-next-door appeal that sublimates into something less earthbound when she sings, her pleasingly throbby mezzo a purring engine in ballads until she lets out the reins and the horsepower kicks in.

The score is a beaut. Bareilles covers the territory with ballads (Jenna’s “What Baking Can Do”), beautiful choral numbers (special mention to the superb musical direction by Nadia DiGiallonardo), big dance numbers (Ogie’s “Never Getting Rid Of Me” and Joe’s “Take It From An Old Man”) and Jenna’s killer Waitress/Jessie Mueller and Nick Corderoanthems. The cast is pleasingly diverse without shouting about it. Scott Pask’s simple sets, the lived-in clothes by Suttirat Anne Larlarb and Christopher Akerlind’s moody, kinetic light scheme add to the leavened sense of a caringly crafted confection. Waitress is a feel-good show that’s no mere guilty pleasure. It’s got soul and heart, sweetness and crust all in fine measure.

Returning to my original point: Adrienne Shelly was murdered shortly after Waitress was completed; she never lived to raise her three-year-old daughter, let alone see her film open at Sundance and become an offbeat favorite. (It’s a little surprising to find no dedication to her in the program.) Bareilles has written a score true to the spirit of the movie and to Shelly herself. But she is gone.