Getting the rock group to play "Carry On Wayward Son," the show's unofficial theme song, was an idea three years in the making.

How did Supernatural pull off a surprise rock show in the middle of San Diego Comic-Con?

Ending the annual pop culture convention with a bang on Sunday, iconic rock band Kansas surprised more than 7,200 Supernatural diehards assembled in Hall H with a live performance of the show's unofficial theme song, "Carry On Wayward Son." With an impressive light show and screens spanning the entire length of the biggest room at Comic-Con playing highlights from the past 12 seasons of The CW's longest-running series, the event was less like a panel and more like an arena rock concert.

But it was actually a surprise three years in the making. The idea first came from Supernatural publicist Holly Ollis, and Warner Bros. Television spent the past few years trying to make that idea a reality. It was kismet that Kansas' touring schedule had an opening this year that allowed the band to come to San Diego and open the panel.

"We've been discussing what we were going to do with Supernatural for about six to eight months," WBTV chief marketing officer Lisa Gregorian says. Since the Warner Bros. theatrical group had already purchased a package to use the giant Hall H screens — a cost estimated in the six figures — "they were generous enough to allow us to use them because just creating the content for them is very costly. We used those screens and just by chance, they also put in an incredible lighting package this year, which gave us a lighting package to be able to put on a rock concert. It all came together," she says.

Over the past 12 seasons, "Carry On Wayward Son" has become the unofficial theme song for Supernatural, appearing in every season. It was also reprised in the 200th episode as a slowed-down ballad as a love letter to the fans.

"Kansas is well aware that this has become the sort of anthem of the show," says Tammy Golihew, WBTV executive vp scripted marketing and publicity. "They're very aware of it and they're very into it. It's about their touring schedule too, so about three years ago is when we first made a connection with them to even discuss the possibility of them coming, and we just continued to be in contact with them over the last couple of years. I do believe that this was absolutely the best year for this to happen, due to the fact that we had the screens, we had the lighting package and it really was like a rock concert in there."

Complicated scheduling aside, putting on a rock show in the middle of Comic-Con required immense cooperation and "trust" from all parties involved, including from Comic-Con itself. Golihew revealed that the Kansas surprise "wouldn't have happened without" Eddie Ibrahim, the man in charge of running Hall H.

"They had to give us extra time because we had multiple sound checks and tech checks throughout the week," Golihew says. "They were absolutely lovely."

Warner Bros., Kansas and the Hall H crew had to have a two-hour rehearsal and tech check on Saturday night, long after normal work hours ended. "I mean, these guys are exhausted," Gregorian says. "These tech crews are working day and night and they're doing a two-hour tech check for us. It's pretty amazing, Kansas was doing their performance and there were at best 20 people in a hall made for [7,200]."

Not only did they have to do a sound check, they also had to sync the lighting package, the curtains opening to reveal the giant screens and the content on the screens to the performance. "There was so much technical expertise [that went into it]," Gregorian says.

Making the panel feel even more like a true rock concert, Warner Bros. handed out specially designed Comic-Con Supernatural T-shirts to everyone as they entered Hall H, with all the previous dates and locations of panels listed on the back, like a real concert shirt.

"I know we overthink everything, but we always try and come at everything from, what is the best fan experience we can deliver?" Gregorian says. "Kansas' ['Carry On Wayward Son'] is the unofficial song for the show, but the Winchester boys were born in Kansas. That's part of the story of Supernatural. For us, there's so much to making sure that these experiences are spectacles, that they are fun, that they surprise and just create joy for the fans in the moment."

And the people in charge of making this happen consider themselves "total fangirls," too.

"It's one of those moments where hopefully it's going to connect people, and when it happens in the room and you have that community and you see people shouting and singing and dancing and doing video and freaking out, it's beautiful," Golihew says. "It's what you want. It's what we wanted and more."

Ending Comic-Con with Kansas was just the cherry on top of an extremely packed weekend for the Supernatural stars. Jensen Ackles and Jared Padalecki came to San Diego from the set in Vancouver earlier than they ever have before, beginning on Wednesday with an appearance on a special Comic-Con episode of Conan.

"[Conan] was really important to us," Golihew says. "They'd never done a talk show together of that nature."

Ackles and Padalecki also had life-size Funko dolls made of themselves, which were on display at Warner Bros.' media mixer on Friday night.

"It was all wink-wink nod-nod," Gregorian says. "There was a lot of Supernatural stuff going on ... everything was a wink and a nod to what was going to happen. It would have been hard to guess, but it was pretty cool."

The push for a larger Supernatural presence at this year's Comic-Con — despite the long-running, successful series not needing any additional marketing at this point in the show's run — was a conscious decision on Warner Bros.' part.

"On the industry side, to show every marketing executive, every publicity executive that our job, especially at the studio level, is to always be the best and biggest fans and cheerleaders for our shows, we learned that from [Warner Bros. Television president] Peter Roth," Gregorian says. "Peter reminds us all the time until it is part of who we are in our culture that we are the first place that needs to be supporting all of our shows, regardless of the season that they're in."

So what does this mean for next year's Comic-Con?

"It's going to be hard to top," Golihew acknowledges with a laugh. "But we'll figure it out,"

Adds Gregorian, "Hey, if that's the challenge, we're in."

Check out the full video of Supernatural's Comic-Con surprise below.

Supernatural season 13 is set to premiere Thursday, Oct. 12, at 8 p.m. ET/PT on The CW.