The USS Enterprise-D, responding to a distress call, drops out of warp to discover a nearby Dyson sphere. They trace the distress call to the USS Jenolen, a Federation transport ship that has been reported missing for 75 years, and which has crashed intact on the sphere's outer hull. Riker, La Forge and Worf transport to the Jenolen while the Enterprise investigates the sphere. La Forge discovers that the Jenolen's transporter has been jury rigged to sustain two life signals within its pattern buffer indefinitely, though one has degraded too far to be recovered. La Forge reverses the process and restores the remaining life form, which turns out to be former Starfleet officer Captain Montgomery Scott.
Scott explains during a check up of his health aboard the Enterprise that he was only a passenger aboard the Jenolen during his retirement, but when the ship was caught in the Dyson sphere's gravity field, only he and one other officer survived the crash, and Scott had rigged the transporter to try to keep them "alive" until a rescue vessal could arrive. After being cleared by Dr. Crusher, Scott is eager to see the advances in technology including a tour of the Engineering deck, but quickly finds that his old knowledge has long been surpassed and his efforts to help are instead getting in the way of normal operations. Ordered to leave Engineering by La Forge, Scott heads to Ten Forward, and is upset to learn that alcohol is no longer served on Starfleet ships. Data offers a potent beverage from Guinan's private stock to Scott, which Data can only describe as being "green". With the bottle in hand, Scott uses one of the Enterprise's holodecks to recreate the bridge of his old ship, the Enterprise, to try to relive his past. Captain Picard joins Scott after hearing of his difficulties in becoming adjusted to the 24th century and tries to consol him, to which Scott declares himself a relic of the past.
The next day, in continuing the survey of the Dyson sphere, Picard suggests to La Forge to enlist Scott's help to recover existing survey data from the older Jenolen systems, technology at which Scott is adept. The two return to the Jenolen and begin to recover its memory core with Scott's help. The Enterprise discovers a port on the side of the Dyson sphere, but when they try to communicate with the systems, the ship is pulled into the Dyson sphere by automated controls which temporarily disables their systems. Though they are able to recover control before the ship impacts with the star inside the sphere, they find the star is unstable and emitting large amounts of radiation which will be lethal to the crew, and surmise that the sphere was long abandoned by its creators due to this. The Enterprise quickly realizes the only exit from the interior of the sphere is the port they used but cannot figure out how to open it from this side. When La Forge tries to make contact with the Enterprise, he discovers it missing, and works with Scott to make the Jenolen flight-worthy. They discover the same port the Enterprise found and surmise the Enterprise is trapped inside. La Forge and Scott manage to open the port without being pulled in and then wedge the Jenolen in the open port, using its shields to keep it open while the Enterprise escapes, rescuing the two engineers from the Jenolen just before destroying it with photon torpedoes.
As the Enterprise returns to its mission, the crew of the ship give Scott his very own shuttlecraft "on extended loan" to either continue to his retirement or to explore the galaxy. Scott thanks the crew and reminds La Forge to make the most of his time as the Chief Engineer of the Enterprise before he departs.