Data walks down a corridor, his steps in perfect time. He stops to speak with Geordi about a plasma conduit needing to be installed, then moves on. He hears what sounds like a telephone ringing, then muffled clangs and shouts. Moving on, he sees three workmen breaking through a corridor wall and attempting to dismantle what's behind it. He tries to stop them, but finds himself emitting a high-pitched squeal. "Be QUIET!" snarls the head of the workmen, and all three approach. They overwhelm him, ripping off limbs. Data's head comes off -

- and he awakes, finding himself in his quarters.

Some time later, work is proceeding on the new warp core. Picard is a bit annoyed at being unable to avoid the annual Admirals' Banquet, but other than that there's no real deadline to reach. Data and Geordi, meanwhile, discuss Data's recent nightmare, as well as the crush that a young ensign in Engineering has on Geordi. (Data offers to help talk to Tyler to clear the air, but Geordi hastily assures him that it's not necessary.) Finally, all seems to be working, and they get started on testing the core - but then, actually implementing it stalls the Enterprise out.

Later, Data is watching Spot sleep (and dream) in his quarters when Troi comes in to check on him. Data says that he is somewhat reluctant to continue dreaming because of his recent nightmares. Troi, however, urges him not to run from dark imagery, but to experience it. Data decides to initiate another dream then and there. Troi leaves, and Data dreams...

... finding himself in Ten-Forward, where he sees Worf eating a cake. When Worf is asked what the cake is, he responds, "It is a cellular peptide cake, with mint frosting." Pondering this, Data again hears a ringing. He wanders over to the bar, where Beverly is drinking from a straw that is attached to Riker's head. While Riker tells Data to answer "that damned ringing," Data moves to a side table, where the three workmen are assembled. Data begins to ask them what their business is, but again finds himself emitting a high-pitched squeal. Again, the head worker orders him to "Be QUIET!", and this time Data complies. The workmen move aside, and Data sees Troi on the table - except that her lower body is missing, and her upper body is a cake. Data moves to the cake and begins cutting, and Troi cries out in pain -

- and then the real Troi wakes Data up. Data discovers that his chronometer was supposed to wake him over thirty minutes ago...

Data and Geordi run a diagnostic of Data, and find no problems. Geordi suggests that this whole experience may have been intentionally designed by Dr. Soong to make Data more human, and Data admits the possibility. When asked to describe his nightmare, though, Data demurs, saying that "`strange' is not a sufficient adjective to describe the experience."

Data consults with a holodeck recreation of Dr. Sigmund Freud, who is most intrigued by elements of the nightmare, particularly the long knife. He spouts reams of analysis about Data's repression and sexual desires, and eventually goes so obviously wide of reality that even Data can see there's no point in continuing. The core is repaired, and all is ready to proceed again - only this time, initiating warp blows a power converter, killing both the warp and impulse engines for quite some time.

Data continues his work in Engineering, still slightly unnerved by his dream. However, things get even stranger when Geordi hands him a probe to analyze, and the probe looks identical to the knife from Data's nightmare! Data turns to tell Geordi about this fact - but sees a small mouth open and close on Geordi's neck. Data backs away, and enters the "anteroom" of Engineering, which is unusually empty. Data hears the ringing again and turns to try to locate it, but cannot. Suddenly, Riker appears, still with a straw protruding from his head, and tells Data to answer it. Data opens his own chest, revealing a telephone. He picks up the receiver, only to hear Freud's voice saying "Kill zem. You must kill zem all before it's too late." Suddenly, Geordi taps him on the shoulder -

- and Data turns to find Geordi looking concerned, and sees that he is still holding the probe as if it were a telephone.

Data goes to Troi, now very concerned, all the more so because he's ruled out any technological origin for the experience. Troi muses that Data seems to be becoming almost obsessive about himself, nearly neurotic. This fact, ironically, cheers Data up. Troi suggests a regular counseling session for a while, and urges Data to turn off the dream program for the time being.

Picard speaks again to Admiral Nakamura, making excuses for their lateness. Nakamura is not pleased, and a disgruntled Picard goes down to Engineering to "help" with the repairs. Eventually, he is led away to let Geordi and Data do their jobs, but when Geordi turns to Data in relief, he finds that Data is gone - and so is the probe. Troi, some distance away, feels a premonition, but sees nothing to encourage such worry. She enters a turbolift, but at the last second Data joins her, stabbing her repeatedly in the shoulder with the probe. Riker and Worf come upon them only moments later and subdue Data, calling for a medical team to help Troi.

Later, Data describes his dreams, both sleeping and waking. All of the staff are taken aback by the nature and intensity of the imagery, and concerned by Data's uncontrollable urge to eliminate the image of a mouth he saw on Troi's shoulder. Data is temporarily relieved of duty and confined to quarters.

In sickbay, Troi wakes in a panic. Beverly reassures her that everything will be all right, but then becomes concerned herself when the wound appears to have left a rash. She calls for an interphasic scanner and begins to investigate, as Data asks Worf to take care of Spot for him.

Shortly thereafter, Picard comes to sickbay to hear grim news. Beverly has discovered that the cells in Troi's shoulder are breaking down - and an interphasic scanner shows an insectlike creature on her shoulder, feeding in some way. However, it doesn't end there - there is a similar creature on Bev's sleeve, and Riker's head, and Picard's neck ... in fact, on nearly everyone on the ship; and they're spreading...

The creatures are draining cellular peptides, threatening the cohesion of their bodies. Given the interphasic state in which they exist, there is no known way to affect them. However, the correlation between Data's dream-perceptions and the locations of the creatures is enough that they think Data might hold the key to what's going on, and they decide to investigate his dreams. Data agrees to hook himself into the holodeck, in effect putting Picard and Geordi into his dream. Data is connected up and begins to dream...

Picard and Geordi find themselves in an Enterprise corridor, able to act as if they were simply a part of Data's dream. Data appears and greets them, and they follow him to Ten-Forward. As they hear the telephone ringing, Data offers them cake. They ask what the cake is, only to be told "it is a cellular peptide cake."

"Wf mnt frfting," offers Worf helpfully.

Continuing around the room, Picard and Geordi find Riker and Bev at the bar again, with Riker complaining about the ringing and Bev offering them a sip of Riker's head. Picard and Geordi speculate about what the ringing might symbolize, settling on communication. Geordi opens Data up and answers the phone, but then hands it to Picard, saying "it's for you."

Picard answers, and hears "Kill zem." "Kill who?" "Kill zem before it's too late." "Who is this?"

The scene around them changes - to Freud's office. Freud speculates that he symbolizes Data's unconscious mind, warning Data (and now them) about the dangers they face. When Picard asks how to kill the creatures, the phone rings again. "Answer it." Picard moves to do so.

"Nein, nein, NEIN. Do not be so literal. When I say answer it, I mean respond to it. To zem."

Suddenly, the workmen burst in, shouting at Freud to "be QUIET!", and shoot him, a mortal wound. They move Data and the couch on which he lies away from the wall and take down a curtain, revealing the plasma conduit Data and Geordi installed with the new core. Picard realizes that the "to zem" might mean the workmen, and asks who they are. "We are your enemies," they respond, approaching menacingly.

"Stop," says Data, now joining the scene. "You must not hurt my friends." He again emits the high-pitched squeal.

"Be QUIET!" they yell, and Data stops. Picard, however, realizes that the squeal causes them pain, and urges Data to resume. He does, and the workmen crumple to the floor in a heap.

"I believe I understand," says Data, and wakes. He asks Geordi to help modify Data's brain to emit an interphasic pulse, which he believes will destroy the creatures infesting the ship. The process is successful, and the infestation is eliminated.

The creatures, it turns out, were attracted to the plasma conduit when it was built using a new interphasic technology, staying dormant until the warp core was activated. All is well - but Picard misses the banquet, and Data finds turnabout is fair play when Troi evens the score by serving him a cake of himself "to snack on."