Jack Rowand/The CW
(CNN) —  

“The Flash” struck many beautiful notes in its musical episode, “Duet.”

TV watchers are all too familiar with the bitter aftertaste of a musical episode gone sour (Sorry, “Grey’s Anatomy”). But “Flash” – with help from visiting heroes and friends from “Supergirl” – managed to avoid some major pitfalls.

How? Glad you asked.

This cast can really SING

“Flash” and “Supergirl” stars Grant Gustin and Melissa Benoist were joined on screen by fellow “Glee” alum Darren Criss, who took on the role of the Music Meister, a foe who put Barry and Kara into a musical reality from which they had to escape (He wanted to, in his words, teach them “a lesson”). In addition to that talented trio of Gustin, Benoist and Criss, the episode benefited from the collective talent of some regulars in the CW heroverse.

There was a time – before he was Joe West on “The Flash” or Ed Green on “Law & Order” – that Jesse L. Martin was most famous for playing Tom Collins in the musical “Rent.” And Carlos Valdes pre-Cisco roles included a part in the musical “Once.”

There were also guest appearances from John Barrowman and Victor Garber, both Broadway vets. They shared a cover of the “Guys and Dolls” tune “More I Cannot Wish You” with Martin.

There can be something charming about amateur or reluctant singers taking on the challenge of a musical episode. Sarah Michelle Gellar, for example, told E! News in an interview years ago that she was less than enthusiastic about singing in the “Buffy the Vampire Slayer” classic “Once More, with Feeling.” In that episode’s case, Gellar’s literal voice was key to the tone and intention of the episode.

But in other cases, music in incapable hands simply falls flat, literally and figuratively.

Lucky for “The Flash,” there wasn’t a single weak link among them.

It mixed originals and covers

The episode opened with a “Moon River” cover sung by Benoist and the musical moments only got better from there.

Two more covers followed: “Put A Little Love In Your Heart” featuring Criss, Jeremy Jordan, Barrowman and Valdes and the aforementioned “Guys and Dolls” track.

If the spirit of original “Super Friends” was familiar to any CW loyalists, that’s because it was co-written by “Crazy Ex-Girlfriend” star and creator Rachel Bloom. In the super hands of Gustin and Benoist, the song was infused by the energy and spirit it required.

The real treat here, though, was ballad “Running Home to You,” a song penned by “La La Land” songwriters Benj Pasek and Justin Paul. It was the episode’s closing number and served as a proposal song for Gustin’s Barry Allen, who popped the question to Iris West (Candice Patton) despite the couple having been broken up.

With lines like, “And all my life I promise to, keep runnin’ home to you,” it touched on all the right emotional notes in a way no other song could for the Fastest Man Alive.

“The Flash” may not have had the time or resources to pour into a full episode of original tunes, but the show sure used them wisely.

It moved the plot forward

Barry and Iris’s engagement wasn’t the only reunion that happened in the hour.

The Music Meister had set out to teach both the Flash and Supergirl a lesson about love, and he accomplished exactly that.

“Love is about letting yourself be saved. It’s not just about saving other people, even if you are superheroes,” he told them, after Kara and Barry were extracted from the musical world by their respective significant others, Iris and Mon-El (Chris Wood).

Prior to Barry’s proposal, Kara made up with Mon-El.

The CW superhero universe can at times go overboard with the gimmicks, with crossovers and “event” episodes. But a gimmick used to benefit the story in a meaningful way – and in this case, stories on two shows – is the only kind worth doing.

And the kind that leaves you hoping for an encore.