The U.S.S. Enterprise crew is surprised to encounter the U.S.S. Jenolen, which crashed 75 years ago, on the surface of a tremendous gravitational force known as a Dyson Sphere. However, they are even more surprised to discover a survivor hidden in the ship's transporter. The legendary Captain Montgomery Scott has survived for three quarters of a century by keeping himself suspended in molecular limbo in the ship's transporter system. The crew beams the exhausted veteran back to the Enterprise, where, being the Chief Engineer of the first U.S.S. Enterprise NCC-1701, he is dazzled by the ship's display of 24th-century technology.
Too restless to remain confined to quarters as Dr. Crusher recommended, Scotty tracks Geordi down in Engineering and offers his services. Instead, he ends up exasperating Geordi with his "war stories" of adventures aboard the old Enterprise. Finally, Geordi tells Scotty he is in the way, and the depressed veteran returns to his quarters. He is soon visited by Troi, who hopes to help him through the ordeal of finding himself 75 years in the future. But when he realizes Troi is a psychologist, he assumes her visit was mandated by Geordi and storms off to the Ten-Forward to drown his sorrows.
Still clutching a liquor bottle, Scotty visits the holodeck, where he has the computer simulate the Bridge of his old Enterprise. Unfortunately, it just isn't the same without the rest of his mates. He is about to sink into a nostalgic reverie when Picard suddenly appears in the holodeck doorway. Understanding his visitor's sense of displacement, Picard joins Scotty for a drink and a memory, and Scotty confesses to feeling old and useless. Picard feels sympathy for his guest, and later asks Geordi to accompany the old captain to survey the Jenolen in order to make him feel useful again. Geordi immediately understands, and the two transport to the Jenolen. Moments later, the Enterprise is suddenly caught by the Dyson Sphere's gravitational force and is pulled toward a star inside the sphere.
Luckily, Riker manages to maneuver the Enterprise out if its deadly spiral. However, moments later the ship is rocked by a solar flare that is raging from the star. Meanwhile, on the deck of the Jenolen, Geordi and Scotty are able to reenergize the Jenolen, only to realize that they have lost contact with the Enterprise. By following its ion trail, they realize that the ship is making the same mistake that the Jenolen did 75 years before by opening a channel in the sphere that will ultimately pull them to the sphere's center.
In order to facilitate the Enterprise's escape, Scotty suggests that the Jenolen remain a good distance from the sphere and move in at the precise moment to jam open the hatch. Though skeptical, Geordi agrees to go ahead with Scotty's plan and they are able to contact the Enterprise to tell them. The plan appears to work, until Geordi and Scotty realize that they must destroy the Jenolen to clear a big enough path for the Enterprise. They instruct Picard to fire on the smaller ship, and are able to transport to safety aboard the Enterprise just as the Jenolen explodes. Later, as a farewell gift, the crew thanks Scotty by presenting him with one of their shuttlecraft so that he can continue his adventures in the 24th century.