The Enterprise makes its way toward Kaldra IV carrying a delegation of Ullians, an alien race of telepathic historians who conduct research by probing their subjects' long-forgotten memories. The head of the delegation, Tarmin, immediately demonstrates this ability when he helps Keiko resolve a repressed childhood memory. However, Picard, Dr. Crusher and the rest of the crew are reluctant to let the Ullians examine them, and Tarmin's son Jev admonishes his father against probing their thoughts without permission. Troi leaves the meeting with Jev, and later that evening, experiences an unexplained flashback of a romantic interlude between herself and Riker. Suddenly, Riker's advances become rough, and Troi discovers that Jev has replaced Riker in her memory. As she struggles against Jev, she falls unconscious.
In Sickbay, Dr. Crusher tries to find an answer to Troi's sudden comatose state. In search of an answer, Riker asks Jev about his visit with Troi the previous evening. Jev is offended when Riker suggests that the Ullians allow Dr. Crusher to examine them for any harmful organisms. Later that day, Riker flashes back to a disaster aboard the Enterprise. When Jev replaces a crew member in his memory, he too falls into a coma.
With two crew members inexplicably unconscious, Dr. Crusher asks Geordi to conduct a ship-wide diagnostic for any agents that could have produced these tragedies. Through further examination, she discovers that Riker and Troi's brain tissue show a similar abnormality in an area associated with memory development. Because of this, she and Picard still suspect the Ullians are somehow responsible for the comas despite the fact that they pass all of her medical tests. Her research ends, however, when she falls into a coma as well.
Data and Geordi pick up where Dr. Crusher left off, examining incidents of comas among other peoples visited by the Ullians. Meanwhile, Picard asks the Ullians to voluntarily quarantine themselves to protect the crew from any further damage. Later, Troi regains consciousness, and despite her discomfort, agrees to allow the Ullians to attempt to clear themselves by having Jev probe her memory of the night she fell unconscious. She begins to experience the same flashback about Riker, but is horrified when he is suddenly replaced by Tarmin.
Believing Tarmin's memory invasion is responsible for the comas, Picard and Jev make plans to prosecute him. However, when Jev visits Troi to say goodbye, she experiences the flashback again and realizes it was Jev, not Tarmin, who replaced Riker before she fell unconscious. Frightened, she tries to escape, but Jev charges toward her. At the same time, Worf and Data discover Jev was the only Ullian present in every instance where a coma occurred during one of his people's visits to another race. They race to Troi's quarters and arrive just in time to save her from Jev.