Tinker, Tenor, Doctor, Spy

The Doctor is disappointed because he wanted to travel with the Away Team to an unknown planet. He therefore files a formal complaint with Captain Janeway regarding poor treatment by the crew. He also requests to be made Emergency Command Hologram, or the new Captain, in the event of a catastrophic emergency. However, Janeway tells him that it just isn't possible.

In one of his daydreams, the Voyager crew is sitting in a meeting when Torres begins to rub her foot up the Doctor's leg. In the next daydream sequence, the Doctor walks into a party celebrating his promotion as Emergency Command Hologram.

In the meantime, an alien vessel tries to access Voyager's internal sensors. However, they are unable to get past its security encryption. One of the aliens named Phlox discovers that the Doctor is a computer program and he is able to watch everything that the Doctor is experiencing on Voyager, including his daydreams. Phlox discovers that Voyager is a lost vessel that is not from the Delta Quadrant.

In the Doctor's next dream, Voyager is attacked by Borg. Tuvok and Chakotay begin to sprout Borg implants and Captain Janeway is killed by the attack. The Doctor immediately takes control and tells the computer to activate the Emergency Command Hologram. The Doctor's uniform magically changes to a command style. The new Captain orders the release of his imaginary "photonic cannon," which destroys the Borg sphere.

Phlox still doesn't know that what he is witnessing is only taking place in the Doctor's imagination. The aliens think that Captain Janeway was killed in the attack and that the hologram is now in command of the vessel. They begin to plan their attack.

The Doctor tells Kim, Seven of Nine and Torres that he is having cognitive projections or daydreams. However, because his algorithms are malfunctioning, he is daydreaming whether he wants to or not. As a result, he is randomly jumping from one daydream to the next.

The crew is able to watch what the Doctor is experiencing. Captain Janeway is amazed when she sees the Doctor take command of Voyager. Meanwhile, Phlox realizes that he was only watching the Doctor's daydreams. He is afraid to tell his superiors because they don't tolerate mistakes very easily. Because Phlox feels that he has gotten to know the Doctor, he decides to transmit a simulacrum of himself into the Doctor's program and warn Voyager of the alien attack.

In return for warning Voyager of the attack, Phlox asks the Doctor to pose as the Captain in order to trick his commanders. When Voyager is hailed by the alien vessel, Captain Janeway tells the Doctor what to say by remote. Just as the alien vessel orders a type-four assault, the Doctor instructs Chakotay to activate Voyager's phony "photonic cannon." Phlox reminds his commanders how the "photonic cannon" easily destroyed the Borg. As a result, the alien vessel retreats.