Star Trek: 25 Greatest Next Generation Episodes
A transport ship found on the surface of a fully functional Dyson Sphere is discovered by the Enterprise, and a salvage team discovers in the transporter buffer none other than the man, the myth, the legend Captain Montgomery Scott, who used the buffer to preserve his pattern after the ship crashed 75 years ago in the hopes of being found one day.
Scotty, who was on his way to a peaceful retirement, sees his rescue as a sign that he's not ready to give up just yet and offers to be of service, much to the chagrin of an unusually nasty Geordi who becomes quickly peeved by Scotty's mere presence. After Picard asks him to let Scotty feel useful, they beam down to the transport ship to get it up and running again when the Enterprise is pulled into the sphere.
In a moment of quick thinking, Scotty uses the shields of the transport ship to hold the hatch open long enough for the Enterprise to escape, and seeing as Scotty gave his ship to save theirs the crew gives him one of their shuttles to go wherever he pleases.