(CNN)This article contains spoilers about the season finale of "NCIS."
Bet you didn't see that coming.
In the season finale of "NCIS," the show welcomed back Ziva David (Cote de Pablo), a character who hadn't been seen on the show since her 2013 departure.
Ziva's guest appearance came at the end of an episode in which Gibbs (Mark Harmon) helped Fornell (Joe Spano) crack a case involving his daughter, who was struggling with opioid addiction.
Throughout the episode, Gibbs is haunted by the ghost of his ex-wife Diane. So in the final minutes of the finale, when he hears noise while in his beloved basement, he expects to see her once again. Instead, it's Ziva who descends down the stairs.
"Hello, Gibbs," she says. "No time for pleasantries. You're in danger."
He is speechless.
"Well, aren't you going to say something?" she asks.
"Ziver," he replies, a reference to his nickname for her.
"NCIS" producers confirmed Tuesday night that de Pablo will guest star in the season 17 premiere of "NCIS" in the fall.
Though Ziva was last seen on the show six years ago, her legacy has loomed large over it.
When agent Tony DiNozzo (Michael Weatherly), Ziva's love interest, left the series in 2016, it was because his character learned that he had fathered a daughter with Ziva, who died in a mortar attack while living overseas. It was mentioned at the time that Ziva's body was never found, leading loyal viewers to speculate she was alive.
Then earlier this year, "NCIS" fanned the flames of that theory with an episode in which Bishop (Emily Wickersham) worked a case that had ties to Ziva. At the end of that episode, a note was left for her that read, "Eleanor Bishop, for the safety of my family, please keep my secret."
The producers of "NCIS" worked hard to keep their season finale secret.
According to CBS, the scene involving Ziva's return was never included in any script or call sheet, which are distributed to crew members.
Only "NCIS" showrunners Frank Cardea and Steven D. Binder had copies of the scene pages.
In addition, de Pablo's scene was filmed at midnight with a skeleton screw after the regular crew had been wrapped for more than an hour, the network said. Her arrival to the stages where "NCIS" films was also coordinated for ultimate secrecy, with her arriving via a back entrance.
"This surprise moment is just the beginning," Cardea and Binder said in a joint statement.
"NCIS" will return in the fall, which is great because we're willing to bet viewers have questions for her.