Sir Topham Hatt, normally in charge of the railways on Sodor, is on holiday and has left Mr. Conductor (Alec Baldwin) along with Winnie the Pooh and his friends in charge. Meanwhile, Thomas (Eddie Glen) and Gordon encounter an evil diesel locomotive, Diesel 10 (Neil Crone), yelling to get out of his way and stating that he has unfinished business on Sodor and he wants to finish it quickly. Thomas and Gordon are shocked.
Mr. Conductor has problems of his own. The mysterious gold dust that allows him to magically transport from place to place is running out, and without it there will be no way for anyone to travel from Shining Time to Sodor or back again. There is a lost engine that is able to travel between Sodor and Muffle Mountain (located near Shining Time) via the Magic Railroad, but nobody knows where she is.
An old man named Burnett Stone (Peter Fonda) lives on Muffle Mountain, near Shining Time Station. Unknown to everyone, he is the guardian of the lost engine, whose name is Lady. The engine crashed after an earlier encounter with Diesel 10, and ever since then Burnett has been trying to repair Lady. But though he seems to have gotten the little engine restored mechanically, so far he has been unable to make her steam.
Percy and Thomas find out that there is a secret railway and there are magic buffers that lead to it. However, Diesel 10 overhears them. Toby the Tram Engine follows D-10 and hears him telling Splatter and Dodge (whom collectively he calls "Splodge" because he arrogantly claims that he hasn't time to address them individually), his diesel locomotive "hench-trains" and Infiltration Unit 7, that he will find the buffers and destroy all the steam locomotives by destroying Lady, the Golden Engine. D-10 thinks that this horrid act seems possible largely because Mr. Conductor's "sparkle" (a magic whistle with gold dust inside which he uses to travel from place to place) is running out, and he is therefore becoming too weak to stop D-10. Toby, wanting to delay the crime till he can warn his buddies, suddenly rings his bell, distracting Diesel 10, Splatter and Dodge. Diesel 10 says "It's the old teapot, smash him!" But he accidentally fractures the roofing of the shed they are sheltering under, and it collapses on top of them, trapping them, while Toby runs off, causing "Diesel 10 to be in a dump".
Burnett's granddaughter Lily (Mara Wilson) comes to visit him. During her stay, she meets C. Junior, Mr. Conductor's good-natured but lazy and bumbling cousin, who takes her to Sodor and introduces her to the talking engines who live there, including Thomas the Tank Engine. Later, Thomas is assigned to transport Lily back to her Grampa on Muffle Mountain, having accidentally discovered the entrance of the long-abandoned Magic Railroad by an old grotto. He finds a truck of special Island-of-Sodor coal he lost and takes it with him. He arrives on the other end of the Magic Railway, which is at the edge of a high cliff near the top of Muffle Mountain, and Lily goes to her grandpa's house, leaving Thomas stranded on the mountain. Suddenly, the earth under the track gives way, and Thomas tips forward --- uncoupling himself from the coal-truck in the process --- and falls off the cliff and rolls all the way down the mountain to the bottom where he re-enters the Magic Railroad through another portal there.
Lily reunites with Burnett at his workshop, where he shows her Lady, the lost engine, and explains his problem getting the engine to steam. Lily suggests using Island of Sodor coal from the truck Thomas brought. This proves to be exactly what was needed, and the engine comes to life. For the first time in years, Burnett smiles. Lily and Burnett take Lady along the Magic Railroad, which regenerates beneath her wheels, creating brilliant showers of twinkling multicolored shavings in the process. As the Magic Railroad is reborn, Lady's face appears, and she speaks for the first time, happily commenting that Burnett had never forgotten about Magic. The travelers reunite with Thomas and find their way back to Sodor, where Diesel 10 finds them and gives chase. He is foiled by a damaged viaduct which collapses beneath him, sending him plummeting into the ravine below, where he lands in a barge filled with sludge and is carried away.
Thomas, Lady, Burnett and Lily meet Mr. Conductor and C-Junior. They use the water from a wishing well and shavings from the rails of the Magic Railroad to make more gold dust, and the Island of Sodor and Shining Time Station are saved. C-Junior, encouraged by his success in being able to help out, offers to take a job on Sodor, and Mr. Conductor presents him with his conductor's cap and a spare uniform so that C-Junior can now assume Mr. Conductor's role on Sodor, while Mr. Conductor says that he will now travel back to serve at Shining Time Station. In the end Thomas is happily going home to Tidmouth sheds to tell the engines about his encounter with the lost engine Lady.