The Enterprise landing party is looking for tritanium, unaware that a mist is floating in the background. Kirk notices a honey-like odor that reminds him of a similar odor from years ago, and orders the security team to search out a gaseous cloud and scan for dikironium. Kirk advises Scotty of the search and the engineer warns that they have a rendezvous with the Yorktown in eight hours to drop off medical supplies.
The security team picks up traces of dikironium but note that it keeps changing to something different. The cloud envelops two of them and they collapse, choking, while the third man calls for help before it envelops him as well. Kirk and Spock go to investigate and find the men dead, every red blood corpuscle drained from their body. The last man, Rizzo, is barely alive, and they beam him up to the ship along with the remaining personnel. McCoy and Chapel work to maintain Rizzo while Kirk informs the senior staff that he is postponing the rendezvous with the Yorktown to investigate the deaths. He then informs McCoy to check the medical records of the Farragut eleven years ago, and has the doctor revive Rizzo. Rizzo describe the same odor and says he sensed an intelligence, further confirming Kirk's suspicions. Rizzo passes out and McCoy dismisses his testimony, and Kirk abruptly storms out.
Back on the bridge, Kirk ignores an incoming Starfleet message concerning the Yorktown and has Spock assume their target is intelligent and can hide from a sensor scan. When Spock notes it would have to be able to transmute itself, Kirk recommends he look at the same Farragut tapes. The new security officer, Ensign Garrovick arrives on the bridge and Kirk recognizes his father but refuses to give him any special treatment. They get word Rizzo has died and Garrovick, his friend, wants a crack at it. Kirk takes more security men down to the planet where they pick up new dikironium readings. They split up and the creature attacks Garrovick's team. He pauses momentarily and then fires his phaser. Kirk and the others come running and find Garrovick's two men dead.
Kirk believes the creature is intelligent but has his doubts. Garrovick gives his report but can't confirm it's an intelligent creature. Kirk notes he didn't come into contact with it but wonders why Garrovick didn't hit it while it was hovering. He berates Garrovick for freezing and relieves him of duties and confines him to quarters. Kirk then abruptly tells Spock and McCoy to fill their reports, and dismisses Scotty when he mentions they'll be leaving. Scotty proceeds to clean out the radioactive disposal vent on the number 2 engine, while Chekov scans the planet but finds no traces of the cloud. Kirk becomes increasingly irritable, snapping at the crew.
Spock goes to see McCoy and ask his opinion on the emotion of obsession, then refers him to the Farragut tapes. After reading them, McCoy visits Kirk and talks about how eleven years ago Kirk was on his first assignment on the Farragut, which Captain Garrovick commanded. Kirk froze for a second and over 200 men were killed. Although he was cleared by Starfleet, Kirk blames himself. When Kirk doesn't back down, McCoy calls in Spock to confront Kirk about his command decisions. The captain insists the cloud is a sentient creature and McCoy leaves his log open.
They detect the creature leaving orbit and follow it at warp speed. Spock confirms the creature is borderline between matter and energy and they can't maintain maximum speed. Kirk reluctantly orders them to slow and ignores the alarm on the open vent that Scotty has undergoing maintenance.
Nurse Chapel brings a meal to Garrovick and forces him to eat. Meanwhile, the creature slows down and the Enterprise approaches it, phasers ready. In his quarters, a furious Garrovick throws the lid of his dish at the ventilator controls, knocking it open. He goes to the bridge, as they discover that phasers and torpedos don't affect the creature. It attacks the ship and enters through the open reactor vent, killing one crewman and wounding another. They have only two hours of air left and Spock notes the creature is clearly intelligent. They try to flush radioactive waste into the vents to clear them out, and Spock notes that Kirk wasn't to blame as weapons would have had no effect eleven years ago either. Spock then goes to Garrovick's quarters and tries to reassure him as best he can, but the creature pours in through the vent. Spock gets Garrovick out and tries to seal off the vent manually.
Kirk, McCoy, and a security team arrive as they reverse pressure to pull it back into the ventilation system. Spock emerges to reveal that the creature didn't feed on his green copper-based blood. Kirk smells the creature and senses that it is returning home: to Tycho 4 where the Farragut encountered it eleven years ago. Kirk then talks with Garrovick and notes that his delay made no difference.
They flush the creature out into space and track it back to the Tycho star system. McCoy is concerned that the drugs they have for the Yorktown are perishable but Spock reports that the creature is probably returning home to spawn, and will create thousands of itself. They decide to use an anti-matter bomb to destroy it, and a tube full of hemoglobin to lure it in. Spock warns that the Enterprise could be injured during the shock, and they could lose anyone beaming up. Kirk decides to set the trap himself but it will take two men to carry the anti-matter: Garrovick volunteers and Kirk accepts.
Kirk and Garrovick beam down to Tycho 4 and move away to plant the anti-gravity container holding the anti-matter. However, the creature gets to the hemoglobin and drains it of red corpuscles. It starts to move toward them and Kirk orders Garrovick back to the ship while he acts as bait. Garrovick refuses and the two men fight briefly until Kirk explains he isn't planning on killing himself. The creature approaches them and Kirk orders beam up and detonation. The shock wave hits the ship and they struggle to bring Kirk and Garrovick through. The two materialize and Kirk orders them to rendezvous with the Yorktown, then offers to share some tales about the ensign's father later in private.