Seamus Dever, Stana Katic and Nathan Fillion

To step onto Castle's Hollywood soundstage one early October afternoon is to boldly go where no author and his muse have gone before. Today's action is unfolding not in a gritty NYPD precinct, but on an elaborate spaceship set, all sleek steel and high-tech consoles, manned by actors clad in costumes that would look right at home aboard the USS Enterprise.

Under the watchful eye of director Jonathan Frakes (aka Star Trek: The Next Generation's Commander William T. Riker), a Shatneresque captain stoically assesses his crew's chances of survival against a merciless alien race, until he's interrupted by Det. Kate Beckett (Stana Katic) and mystery novelist Richard Castle (Nathan Fillion), whose 21st century presence quickly brings this intergalactic mission back down to Earth. That is, until Castle playfully fires what he thinks is a prop laser gun and — holy frak! — it blasts a hole into the side of the spaceship. (At least it will by the time viewers tune in, thanks to post-production special-effects magic.) "You," says Castle, turning to a murder suspect who's been participating in a fan reenactment of a cult sci-fi show, "are so busted."

Buckle up, Castle fans: In the November 5 episode of ABC's hit drama, the crime-solving duo are trekking into new territory: a sci-fi convention. After a woman turns up dead aboard the starship replica, Castle and Beckett find themselves thrust into the world of rabid fandom known as SuperNovaCon, clearly modeled on San Diego Comic-Con. "Other shows do [episodes set at] science-fiction conventions and it seems they're always contemptuous of the people there," says executive producer and self-described "closet geek" Andrew Marlowe. "But fantasy plays an important role in everybody's life. We all need ways to escape. We wanted to have fun with this world, but we didn't want to make fun of it."

The episode, titled "The Final Frontier," has already generated plenty of buzz in the blogosphere — never a bad thing during sweeps — thanks to the sci-fi bona fides of Castle's leading man. Long before stealing Beckett's heart, Fillion earned a rock-star reputation among genre fans, thanks to his frequent collaborations with geek-god Joss Whedon (see Firefly, its follow-up film Serenity, Buffy the Vampire Slayer and Dr. Horrible's Sing-Along Blog). The episode pays particular homage to Firefly, his short-lived sci-fi Western on Fox. "I look at Firefly like it was my first love," says Fillion during a break. "When we were canceled, it was awful."

Still, nearly 10 years after it got the ax, the series enjoys a devoted following, not unlike Nebula-9, the fictional show at the center of Castle's SuperNovaCon episode. In another inside joke, Nebula-9's male hero — played by Eureka's Ed Quinn, in a sly, scene-stealing turn — is a wisecracking captain named Max Rennard, an obvious riff on Fillion's Firefly character, Malcolm Reynolds. "We're not so much winking [at the similarities] as we are embracing and making out with them," Fillion says. "With tongue."

Even those less passionate about sci-fi will get a kick out of this markedly quirky case. "I don't speak Klingon or Romulan," says Katic with a laugh, "but this episode is really clever and fun.

"One of my first auditions when I came to L.A. was for [Star Trek: Enterprise]," she continues. "I remember being so excited. I just wanted to wear the pointy ears!"

While she didn't land that role, Katic will get to engage in a little costume-play when Beckett decides to make one of her boyfriend's fantasies come true. But Castle will be less excited by the discovery that Beckett was a hard-core Nebula-9 fan back in her Stanford days; she's uncharacteristically starstruck when she meets its cast at the confab. "I like good sci-fi," an incredulous Castle teases her. "Star Trek. Battlestar. That Joss Whedon show."

According to Katic, the revelation of Beckett's obsession marks another milestone in the "Caskett" relationship. "She's perhaps not as shy or as close to the vest about parts of herself," Katic says. "And that's neat because it means that they're freer together, more open with each other."

Which is a big relief. After an angsty Season 4 found the pair's long-smoldering sexual tension seriously testing viewers' patience, Castle has, in its fifth season, returned to a more playful tone now that the characters are happily committed. And it's done so without succumbing to the dreaded Moonlighting curse: So far this season, the series is winning its time slot in total viewers, even against the new NBC hit Revolution.

Viewers shouldn't expect the relationship bliss to last forever. "That'd be totally boring," Marlowe says. "As we move through the season, we're gonna complicate it."

The November 19 episode will offer one such snag, when the lovebirds bring together Castle's mother, Martha (Susan Sullivan), and Beckett's father, Jim (Scott Paulin). "I'm not sure everybody's gonna be super-excited about everybody else," says Katic of the tense dinner. "I don't know that the parents are gonna get along."

For more with the cast of Castle, pick up this week's issue of TV Guide Magazine, on newsstands Thursday, November 1!

Subscribe to TV Guide Magazine now!