During a brief respite from duty, the U.S.S. Enterprise plays host to three young winners of a primary school science contest. Just as Picard begins to take them on their promised tour of the ship, the craft is struck by a quantum filament that shakes it violently and causes power failures to occur throughout. Communication between different areas of the ship is cut off and crew members are trapped. Picard and the kids are caught in the Turbolift; Beverly Crusher and Geordi are stuck in the Cargo Bay where they are threatened by the combination of a radioactive fire and containers of hazardous materials; while Riker, Worf, Data and O'Brien's pregnant wife Keiko treat the injured in the Ten-Forward. Meanwhile, Troi, the highest ranking officer remaining on the Bridge, finds herself acting as a reluctant ship's captain.

Riker and Data devise a plan to reach Engineering and restore power, leaving Worf to care for the injured. But before they reach their destination, they end up trapped in a narrow crawlspace by an electrical current. On the Bridge, Troi turns to O'Brien and Ro for the technical knowledge that she desperately needs to make decisions, only to find that the two disagree on strategy. Both agree, however, that the ship is in immediate danger of exploding.

Unable to find anything strong enough to stop the flow of energy that stands between them and Engineering, Data offers to use his body. The android assures Riker that he can shield his brain from the energy's effects and emerge with his "mental capacity" intact. Realizing that they have no choice, Riker gives Data the go-ahead. While his body is destroyed, Data's head survives as promised, and Riker removes It. Meanwhile, an injured Picard organizes the frightened children in an effort to escape through a hatch in the turbolift, but their efforts are continually thwarted. In the cargo bay, Beverly and Geordi decide their only hope is to open an external door that might blow the containers of hazardous materials into space and put out the fire. And back in the Ten-Forward, Keiko shocks an unprepared Worf by going into labor.

On the Bridge, Ro and O'Brien clash over Ro's insistence that the only way to prevent an explosion is to separate the Bridge from Engineering, casting that portion of the ship into space. Ro is sure there are no survivors in Engineering, but O'Brien counters that they have no real way of knowing since the area is without power. Forced to make a decision, Troi chooses not to separate the ship and to divert power to Engineering to help anyone who may be trapped there. Ro reminds her that this could mean the destruction of the entire ship, but Troi stands firm. Meanwhile, Geordi and Beverly successfully execute their plan to put out the fire. Upon reaching the door to Engineering, Riker attaches Data's head to the control panel, using the power in his battery to open the door. He and Data are surprised to see the area has power and quickly revive the broken generator, restoring power to the entire ship. Picard and the children are freed from the Turbolift, and Keiko gives birth, with Worf's help, to a baby girl.