The Doctor, Seven of Nine and Harry Kim are on a mission in the Delta Flyer to study preanimate biomatter from a comet. The ship jolts a few times and they realize they are under attack. The captain of the attacking vessel, Ranek, claims the Delta Flyer is transporting a "photonic insurgent" through Lokirrim space, which is forbidden. Kim explains that the "photonic," or hologram, is their Doctor. The patrol vessel grabs the Delta Flyer in a tractor beam and fires a disruption field that begins to decompile the Doctor's matrix. Kim then tells Seven that she must somehow hide the Doctor's program. The Lokirrim beam aboard with weapons demanding the photonic, but Seven announces that they "murdered" him. The boarding party inspects the vessel, and Ranek finds the Doctor's mobile emitter, which Seven claims is her "portable regeneration unit." Ranek confiscates the device regardless. He then orders the Delta Flyer to be secured in the Lokirrim docking bay, and locks Kim and Seven in a holding cell. It is here that Kim finds out that Seven downloaded the Doctor's program into her cybernetic implants, and the Doctor is now in control of her body. For the first time, the Doctor is able to have sensory experiences, including touch and smell.
On the U.S.S. Voyager, unaware of the Delta Flyer crew's predicament, Captain Janeway sets out to rendezvous with them in 48 hours. In the Doctor's absence, Tom Paris is examining Tuvok for a neurochemical imbalance, which turns out to be his Pon Farr, the mating instinct that inflicts Vulcan adults every seven years. Paris promises to provide a special medication from the Doctor's database, and to keep his condition secret.
On board the Lokirrim patrol ship, the Doctor in Seven's body is enjoying the sensation of eating, even though their prison rations taste terrible, according to Kim. Ranek has Seven released and sent to the Delta Flyer for questioning. He asks her about the food replicator and whether it is used to create bio-weapons. Exasperated by his suspicious nature, Seven/Doctor replicates a slice of New York cheesecake to prove it's harmless, and experiences rapture upon tasting it. Before long, Seven/Doctor and Ranek have devoured plates of food and downed several glasses of wine. Despite being inebriated, the Doctor maintains the ruse of being Seven, and tells Ranek that she/he needs the "regeneration device" back. Ranek agrees to hand over the mobile emitter in exchange for medical services, then returns Seven/Doctor to the holding cell.
As Kim holds the mobile emitter, Seven/Doctor injects it with Borg tubules to restore the Doctor's matrix. The disoriented Seven then scolds the Doctor for abusing her body. The Doctor apologizes for his overindulgence, and thanks her for saving his life. The three then make a plan to get a message to Voyager, but it'll involve downloading the Doctor back into Seven's implants.
The patrol ship's tactical officer, Jaryn, takes Seven/Doctor to their medical bay and explains that the patients are suffering from synaptic failure caused by a viral weapon from their photonic enemies. As Seven/Doctor synthesizes a treatment, she/he gets to know Jaryn better and learns about the photonic servant who was part of her own family before the uprising. She/he suggests that Voyager's own "photonic," the Doctor, would have taken a liking to her.
On Voyager, the medication Paris applies to Tuvok isn't working to stabilize his condition. Paris suggests creating a replica of the Vulcan's wife in the holodeck in order to satisfy his longing, and Tuvok hesitantly agrees. While Tuvok participates in the holodeck simulation, the ship comes under attack by a Lokirrim vessel because of "photonic activity" aboard. Janeway agrees to shut down the holodecks and allow the Lokirrim ship to escort Voyager through their territory.
While Seven/Doctor is working with Jaryn in the patrol ship's medical bay, Ranek calls for Seven of Nine to meet him on the bridge. Ranek redirects the ship to a pulsar cluster called the "Window of Dreams," the most beautiful sight in the quadrant, and lets the pulsars' EM vibrations fill the bridge with natural music. Seven/Doctor doesn't realize he's trying to set a romantic mood, until Ranek can't help himself and plants a kiss on her/his lips. Seven/Doctor pushes him away and storms off. Seven/Doctor returns to the medical bay and tells Jaryn about Ranek's behavior, and learns that she has feelings for her captain. Since the Doctor has been developing feelings for Jaryn, he makes an impassioned plea for her to find someone more like him, when Seven/Doctor pulls a neck muscle. Jaryn starts massaging her/his neck, until she/he has certain feelings and pulls away nervously.
Seven/Doctor then gets called to the holding cell to treat Kim, who has been faking a seizure in order to get her/him back there. The Doctor separates himself from Seven into the mobile emitter, and Seven chastises him for kissing Ranek and for getting aroused by Jaryn. After the two argue about living life with or without indulgences, Kim presses them for what they've learned about the ship's com system. Seven now knows Ranek's command codes, and they need to get to the Delta Flyer to transmit them to Voyager. The Doctor conjures up a plan.
Seven/Doctor approaches Ranek and asks for a private meeting on the Delta Flyer, with an apology for her harsh reaction before, and a suggestion that they "start over." She/he offers him champagne, turns on music and starts dancing with him. When Ranek is called to the bridge, Seven/Doctor injects him with a hypospray and knocks him out.
Voyager gets a message from Seven that the away team is being held prisoner, and she provides their precise location and the command codes to disable the patrol ship's shields. Her personality and her comments cause Janeway and the others to realize that the Doctor is occupying her body, which means they're in more trouble than they thought. Janeway orders a phaser shot to the Lokirrim escort vessel, and Voyager makes a quick getaway.
At the patrol ship, Seven/Doctor has brought Ranek to the medical bay, telling Jaryn that he has an especially low tolerance for synthehol. Over Seven/Doctor's objection, Jaryn revives Ranek, who orders Seven back to detention, separate from the other prisoner, suspecting her of trying to aid the insurgents. They then receive word that an alien vessel is approaching, and Ranek takes Seven with him back to the bridge where he can keep an eye on her.
Janeway opens a channel to the patrol ship and demands the return of her people. When they refuse, Chakotay uses Ranek's command codes to disable their shields. Ranek ties the shields directly into their warp matrix, and announces that if Voyager fires, it'll trigger a core breach and their crewmates will die. Janeway sends a message directly to Seven's cortical node asking for her help to disable the patrol ship's shields. The Doctor materializes himself into the mobile emitter, and takes up a weapon while Seven works the shield controls. Ranek fires a weapon at the console Seven is working at, but she has already destabilized the shield grid. When he goes to the console to undo her work, it explodes, throwing Ranek across the bridge and seriously injuring him. Although the Lokirrim order him to stay back, the Doctor insists on treating Ranek, and he refuses to beam back to Voyager until he does, or else Ranek will die. Playing on Jaryn's feelings for Ranek, the Doctor gets her to let him operate.
Ranek is saved, and he and Jaryn both express their gratitude to the Doctor, even though their opinion toward "photonics" in general may not have changed. Back on Voyager, the Doctor is paid a visit in Sickbay by Seven, who brings delicacies and wine that she previously would have considered "indulgent." Since the Doctor can no longer share the experience of eating and drinking, Seven promises to describe the meal to him so he can enjoy it vicariously.