Singer-songwriter Melanie Fontana has worked with South Korean boy band BTS for about a year, ever since she co-wrote its 2018 smash hit “Euphoria”—but until recently, she had never met the seven-member outfit in person. That changed last week, when Fontana prepared to perform with the band on the stage of Studio 8H—an experience from which she still has not quite recovered. As Fontana put it in an interview Monday: “I don’t even think having a baby one day would be as awesome as that feeling.”

On Saturday night, the K-pop superstars performed one song from 2017, “Mic Drop,” and one tune off their latest album, “Boy with Luv”—co-written by Fontana, a veteran whose résumé includes work for acts like Britney Spears, the Chainsmokers, and Justin Bieber. Her first song for BTS was “Euphoria,” which wound up being the first track on their 2018 album Love Yourself: Answer; Fontana later contributed two tracks to this year’s Map of the Soul: Persona. Fontana’s BTS compositions are written in English before being converted into Korean. But despite the language barrier, she found herself forming a connection with the band’s members when she met them for the first time while rehearsing for S.N.L.

“Jungkook was looking at me kind of sideways, and RM looks at me kind of sideways—and Jungkook just covers his mouth and whispers to J-Hope. . . And RM was like, ‘The songwriter!’” Fontana said. Soon enough, they had enveloped her in a group hug: “It was like one of those awesome slow-motion movies, running toward one another, and we had a moment.” The group sat on the edge of the stage as the S.N.L. crew set up—talking about the Music Modernization Act, their sorry sleep schedules, and why they got into music in the first place.

The performance itself was a tricky technical prospect. For “Boy with Luv”—a track Fontana interprets as a callback to their 2014 song “Boy in Luv”—the group used familiar choreography from their music video . . . or tried to, although the S.N.L. stage was a little more cramped than the spaces they’re used to. According to Fontana, group members bumped into each other occasionally as they practiced—though that did not happen often. They were assisted by a last-minute addition to the studio: S.N.L. “brought in a dance floor—like, they actually re-floored the stage on show night,” Fontana said. The new floor, she explained, was smoother, allowing the group to execute specific moves that require sliding on their feet.

Even in rehearsal, Fontana said, the men in BTS are precise dancers: “It still looked better than any dancer I’ve ever seen in my life. They’re just so tight!” They kept their focus, even when surrounded by a horde of security guards, who patrolled every possible point of entry in their midtown rehearsal space—a necessary evil for a group that inspires passionate fan activity wherever it goes. On the day of the show, the group ran through their numbers twice, performing a sound check and a fully-dressed rehearsal for the studio audience. “I would say we went over the songs 10 to 15 times before we actually performed it live,” Fontana said.

Not even the hordes of devoted fans, who had lined up for days just to have a chance at scoring standby tickets, could rattle the gang. “When I actually told RM . . . I was like, ‘You do know that there is a block and a half, working its way toward two blocks of fans, waiting outside for you, right?’” Fontana said. “He just put his hands over his mouth, and he was like, ‘What? Man, no!’ . . . He seemed really flattered.”