The Doctor plans to take a holiday on the planet Ormelia, but gravitational influences draw the TARDIS off course and it materialises in the cargo hold of a gigantic spaceship. As the Doctor explores, a hatch opens directly beneath the TARDIS, dumping it away somewhere in the bowels of the ship. As the Doctor sets off in search of help, he sees a movement in the shadows, but whoever it was doesn't respond to his calls. Shrugging this off, the Doctor goes in search of an authority figure, leaving chalk marks so he can find his way back if necessary. The ship is very large, very grimy, and apparently uninhabited, or so the Doctor thinks until he hears a gruff singing voice and follows it to the ship's boilers. There, he finds a brutish humanoid named Vilgreth, who is taken aback to see someone else aboard his ship. He is suspicious at first, and accuses the Doctor of coming to blow him up; people try to do that all the time, officials who don't like the fact that he lives here alone and doesn't pay taxes to anyone. The Doctor assures Vilgreth that this isn't the case; he's here by accident, and he wants only to get his TARDIS back. But this might be more difficult than he thought; the TARDIS has fallen into the ship's furnaces.
Vilgreth must ensure that his ship's engines, his "darlings", are all right before he will lead the Doctor to the furnace. As he does so, the Doctor asks where he's from, and is surprised to learn that the answer is Devon, on Earth. The TARDIS is indeed in the furnaces, but as the Doctor had hoped, it's survived without a scratch. Vilgreth removes it from the furnace with a pair of mechanical grabbers, and the grateful Doctor offers to give him a tour. Vilgreth is greatly impressed; he seems fascinated with technology and engineering, and claims to have wandered the galaxy ever since he first salvaged this gigantic ship. Happy to have found a friend at last, Vilgreth invites the Doctor to the bridge for a cup of tea and some biscuits; he was taught to appreciate them by Professor Trethui, the man who dug Vilgreth up out of the ground, brought him back to life, and gave him a mechanical voicebox so he could communicate. The Doctor, somewhat puzzled by these claims, lags behind to check that the TARDIS is fully functioning, and as he goes to prepare for tea Vilgreth tells him he's lucky his ship survived; not too long ago, Vilgreth found the half-melted remains of another ship in his furnaces.
The Doctor completes his checks and sets off to join Vilgreth, but he is confronted by another alien -- Operative Stelpor of Ormelian security, who warns him to leave the ship at once before the bomb Stelpor planted goes off. The Doctor, enraged, refuses to listen to his warnings and sets off to warn Vilgreth of the danger. It takes a few minutes for the slow-witted Vilgreth to understand what he's saying, but once he does he's prepared; he's had to track down bombs like this before. This particular one is well hidden, however, but Vilgreth refuses to abandon his darling ship and the Doctor refuses to abandon his new friend. Realising that Stelpor must have been the figure he saw when he first arrived, the Doctor follows his chalk marks back to the cargo hold, where he locates and defuses the bomb. As he and Vilgreth return to the bridge for tea, the Doctor spots a planet through the viewport, but Vilgreth takes no interest; as far as he's concerned, planets are only good for one thing. The Doctor doesn't pursue the matter, as he's rather distracted by the sight of the planet itself; it looks vaguley familiar.
As the Doctor shares tea with Vilgreth, he tries to learn more about him, but Vilgreth doesn't like to talk about his past, claiming not to remember much of it. He remembers working on the farm with Professor Trethui and the lads, and their housekeeper Mrs Burden; he remembers the Professor running a museum for broken-down spaceships, and the quiet nights he spent working on restoring this particular ship. Working with tools made his head feel better... The Doctor, somewhat puzzled, decides that the time has come to take his leave -- and finally realises that the planet outside is Ormelia, his original destination. But when he tells Vilgreth where he's going, Vilgreth suddenly seems to get agitated, and takes his leave of the Doctor, telling him to be on his way if he's got to get going...
As the Doctor makes his way back to the TARDIS, Vilgreth's odd behaviour and the size of the ship finally starts to gnaw away at him. What kind of solid fuel could propel a ship of this bulk? Stelpor emerges from hiding again, realising that at last the Doctor's starting to think about what he's seen, and reveals that the half-melted ship in the furnace was his own. He had no way to escape -- and isn't it ridiculous to assume that anyone would go on a suicide mission to kill a harmless tax evader? The Doctor finally realises the truth; this ship is a planet-eater, and it's heading straight for Ormelia. The Doctor insists that they explain the truth to Vilgreth, but Stelpor simply hands over a datapak revealing Vilgreth's true identity. Some years ago, Professor Trethui made history when he unearthed the remains of the last of the Titanthropes, an offshoot of humanity larger and more intelligent than their contemporaries the Neanderthals -- but an offshoot with a culture which ended inexplicably, and violently, before Cro-Magnon man arrived on the scene. Trethui genetically reconstructed Vilgreth from the fossilised remains, but the normally placid and gentle Vilgreth was given to terrible headaches and violent outbursts of temper. When Vilgreth struck one of the farm lads, nearly killing him, Trethui tried to tranquilise him -- but when Vilgreth saw the gun he went berzerk. The only survivor was the housekeeper, Mary Burden, who hid under the bodies until Vilgreth had gone, never to return...
Now that the Doctor knows all, Stelpor insists that he hand over the detonator core for the bomb he defused earlier. The Doctor still insists that Vilgreth needs help to control himself, but Stelpor claims that Vilgreth is a mistake, an inhabitant of an evolutionary blind alley who should never have been brought back to life. As they argue, Vilgreth arrives, intending to kill Stelpor to protect his darling ship. The Doctor tries to explain to Vilgreth that he's about to kill millions of innocents, but Vilgreth doesn't care. Stelpor shoots him, and the Doctor is forced to run back to the bomb with Stelpor and reinstall the core. The wounded Vilgreth pursues them, enraged that his friend the Doctor has betrayed him just as Professor Trethui did. He won't listen to the Doctor's attempts to explain; the only pain in his head is caused by others, and his ship knows what to do with them. Planets are only good for one thing! Vilgreth attacks Stelpor, wounding him, and, knowing that there's no escape, Stelpor remains to fight Vilgreth off and prevent him from defusing the bomb again. Finally realising that there will be no reasoning with Vilgreth, the Doctor is forced to retreat to the TARDIS and escape. The bomb goes off behind him, destroying Vilgreth's ship -- and Vilgreth. The planet Ormelia has been saved, and all the Doctor had to do was betray and destroy a unique life form who had considered him a friend...