When her best friend turned purple, Miriam Starobin’s thoughts turned to yellow — cartoon hero SpongeBob SquarePants.

The denizen of fictional undersea Bikini Bottom was being credited Friday with inspiring a lifesaving rescue during music class at a seaside school earlier this week.

Miriam, a Long Beach Middle School seventh-grader, and her “BFF,” Allyson Golden, had just finished rehearsing the “West Side Story” classic, “I Feel Pretty,” for an upcoming choral competition when their teacher cracked a joke that had the 12-year-olds erupting in laughter.

“Allyson was chewing gum, which she shouldn’t have been,” Miriam recalled Friday in a mock tattletale voice during an interview in the principal’s office. “We were laughing and then the gum gets lodged in Ally’s throat. And she stopped laughing, which was weird because Ally laughs a lot.”

That’s when Miriam says she recalled an episode of the popular Nickelodeon cartoon, where she believes she saw SpongeBob use the Heimlich maneuver to retrieve a clarinet lodged in the throat of another character, Squidward.

“And I get her up and I do the Heimlich and the gum goes flying out of her mouth,” she said.

Trending stories,celebrity news and all the best of TODAY. This site is protected by recaptcha

Allyson, who pleads guilty to chewing a wad of Trident Original Flavor, realized almost immediately what her friend had done. “I gave her the biggest hug and I was like, ’Miriam you just saved my life. I owe you big time.’ And she’s just, ’Oh, no, it was no big deal.”’

The two were reveling Friday in their newfound fame. Their principal joked that they were considering having “hair and makeup” sessions to prepare for their television close-ups.

One little hiccup in the heartwarming story is that a Nickelodeon spokeswoman says there was never an actual episode of SpongeBob performing the Heimlich.

“Not that we can find,” said spokeswoman Maria Poulos.

She said there was an episode where Squidward swallows a clarinet, but SpongeBob reaches down his throat to pull it out. In another episode, SpongeBob’s pal Patrick tries to perform a “slimelick” maneuver by reaching around a clam, “but it didn’t work,” she said.

Neither Miriam nor Allyson were concerned with such technicalities.

“It didn’t exactly show the Heimlich maneuver, per se, but SpongeBob kicked Squidward in the stomach the same way you would put pressure with your hands,” Allyson said. Miriam says she is also a fan of medical shows like “Grey’s Anatomy,” but never had any formal training in the technique.

She rejects any suggestion that she is a hero.

“I mean heroes are people who literally risk their lives to save people,” Miriam protested. “I mean I did something that really anyone could if they tried.”

This is the second time in recent weeks that Long Beach Middle School has attracted media attention. Earlier this month, teen heartthrob Justin Bieber played a special performance at the school as a reward to students for collecting donations for a food bank.

“This is definitely better than Bieber,” said principal Audrey Goropeuschek. “No offense to Justin Bieber, but I think youngsters at this age get so much bad press — bullying, sexting, drinking — and I think just to highlight something like this where Miriam was so quick to act, I’m just so proud.”