The USS Enterprise-D responds to messages it has received from the SS Tsiolkovsky, a science vessel monitoring the collapse of a supergiant star; the messages suggest that the crew has been exposed to a sudden hull breach amid rounds of laughter. After the Enterprise secures the ship via tractor beam, an away team beams over to the Tsiolkovsky and finds the crew frozen to death in various stages of undress, including the body of a clothed crewmember that falls into La Forge's hands. Dr. Crusher orders full medical examinations of the away team on their return, and finds La Forge sweating profusely and complaining about the temperature. Dr. Crusher orders La Forge to stay in Sick Bay but he manages to slip out, making his way to Wesley's quarters. Wesley, unaware of La Forge's condition, shows him a portable tractor beam device, to which La Forge places an encouraging hand on his shoulder. Meanwhile, Data acting on a hunch by Riker identifies the ailment as one similarly encountered by the original Enterprise under Captain Kirk. La Forge eventually returns to Sick Bay, where Dr. Crusher quickly becomes concerned when she realizes that one can become infected simply by touch. Quickly, much of the ship's crew comes under the influence of the ailment, including Data who finds himself in a sexual encounter with Tasha Yar. Dr. Crusher, struggling against the effects of the ailment, finds the original antidote documented by the Enterprise to be too weak, and works to make a more potent version of it.
Wesley, already infected, uses a digital sample of Captain Picard's voice to lure key Engineering staff away from the Engineering deck, allowing him to erect a force field around Engineering with his tractor beam, and then assumes control of the ship. He allows one of the engineers, Mr. Shimoda, who is acting in a child-like manner, into the force field; Mr. Shimoda manages to remove all of the isolinear chips from the engine control station and plays with them like toys. A fragment of the supergiant is discovered to be on a direct impact course with the two Federation ships, and without the isolinear chips in place, they cannot move out of its way. The chief engineer manages to disable Wesley's force field, and Data is sent to replace the chips; however, Data remains under the influence of the ailment, and appears that he will not finish in time. Dr. Crusher arrives with her successful antidote, which clears Data's head immediately, allowing him to finish the task in time. Wesley, still affected by the mysterious pathogen, manages to reverse the ship's tractor beam field to cause the Enterprise to repel off the Tsiolkovsky, giving themselves the necessary additional seconds to clear the path of the fragment. The crew is eventually cured of the ailment, and Picard partially credits Wesley for helping to prevent a disaster.