Weir joins Ronon in the cafeteria and they discuss chess, and Weir suspects Ronon wants to leave. They get called to the command center when McKay picks up the signal of an Ancient warship, Aurora, which has been activated with the activation of parts of Atlantis. They need to take Daedalus and Weir overrides Caldwell and puts Sheppard's team in command.
As they approach the Ancient ship they sense a second scout ship, a Wraith vessel, which approaches them after they come out of hyperspace. Caldwell orders a missile strike and they destroy the incoming ship. Aurora's hull has been breached in combat and Sheppard's team beams over to the bridge in spacesuits. They find the entire crew in stasis pods and bring them over, and McKay determines the pods show brain activity – their occupants are conscious and interconnected, so they're all communicating among themselves. Rodney has them bring over some empty pods so he can tap into the neural network without going into full suspended animation. Sheppard overrides him and goes in, and finds himself in a sterile white environment. He meets a crewman who calls security and draws a weapon on him.
Sheppard is taken before the Captain and the bridge crew and it becomes clear they have no knowledge that they're in a virtual reality simulation. They lock him up and reveal they're working on hyperdrive modifications to get back to Atlantis and don't believe Sheppard when he reveals the Ancients already lost the war. The Captain is eager to get back to Atlantis because he has information from their recon mission, information on the Wraith's weaknesses. The Captain leaves and Sheppard manages to exert his willpower to pull himself out of the simulation. Sheppard goes back in to obtain the potentially vital information and demands to see the Captain so he can "confess."
Caldwell's crew picks up two approaching Wraith warships and they have 30 minutes before they must disconnect Sheppard from the system. The Captain sends the female First Officer to deal with Sheppard, and he gets a fairly friendly reception as she goes to relay his message to the Captain. Teyla and Ronon are exploring the ship and find a desiccated female corpse and call McKay down to see it. Sheppard pulls himself back out again but there's no one there to warn him, so he goes back in and reappears. The guard has entered his cell so Sheppard takes his weapon and leaves him there, while McKay and the others find a Wraith tied into the system.
McKay and the others aren't sure what the Wraith can do within the system and they have only 15 minutes – otherwise Caldwell will destroy Aurora to keep it from falling into the Wraiths' hands. Sheppard makes his way to the Captain but the First Officer stuns him. As they haul Sheppard off, the Captain begins to question what is going on but the First Officer persuades him to go on and finish the drive modifications. McKay discovers that Sheppard is unconscious within the virtual environment and the Wraith may have booby trapped the program to kill Sheppard if they try to remove him. McKay has no choice but to go in and have Teyla bring them out and beam them back to Daedalus if he doesn't get them out in time.
McKay promptly gets captured and is taken to Sheppard, who is back in his cell. Teyla and Ronon have to stall Caldwell and do so successfully. With McKay's info, Sheppard suspects the First Officer is the Wraith. McKay comes out of the virtual reality and accesses the data device to free Sheppard and knock out the guards, then return to the simulation. They spot the First Officer and try to get to her while Caldwell beams Ronon and Teyla over and they have to give him the whole story. Caldwell prepares to send a team with 11 minutes left, but Teyla asks for a few more minutes and Caldwell reluctantly agrees.
McKay discovers the Wraith infiltrator has deleted the info but is keeping the VR simulation going so she can gain access to Ancient hyperdrive technology and improve their ships so they can get to Earth. McKay thinks he can disconnect the Wraith's pod and he re-emerges, while Sheppard gets to the bridge as the Captain prepares to engage the hyperdrive. Sheppard accuses the First Officer of being a Wraith and explains her plan, and she starts to phase out followed by the entire environment while Rodney disables her pod. She reverts to Wraith form and then disappears from the simulation – unfortunately, McKay now has a Wraith on his hands in real life.
McKay draws his gun then blasts away and runs when the Wraith starts to awaken. Sheppard talks to the now believing Captain but there's nothing he can do – the Wraith info they have is gone. The Captain vows they will achieve a victory while McKay wakes up Sheppard, who promptly finishes off the Wraith. Caldwell beams McKay and Sheppard on board, and Sheppard reveals the Ancient Captain gave him Aurora's self-destruct codes. The Captain addresses his crew in a final farewell speech while Sheppard destroys the ship, eliminating the two Wraith cruisers. Back at Atlantis, they confirm the Wraith didn't get any information. And in a final gesture, Sheppard has everyone toast the crew of Aurora for the end of their long voyage.