As the Doctor and geologist Nasreen Chaudhry arrive by TARDIS in the massive Silurian underground civilisation, they are captured and taken to the Silurian doctor, Malohkeh. The Silurians' hostility is increased when the Doctor recalls his previous meeting with a similar race of reptilian humanoids which were destroyed by humans, a reference to the Third Doctor in Doctor Who and the Silurians. Meanwhile, Amy and Mo escape from Malokeh's experimentation and Mo discovers his son, Elliot, sedated in a chamber and under observation. When Malokeh realises the Doctor is not human, the leader of the Silurian warrior caste, Restac, insists both the Doctor and Nasreen be executed and escorts them to a Silurian court; though Amy and Mo interrupt the trial with stolen weapons, they too are captured. Eldane, Restac's superior, is called in by Malohkeh and demands a halt to the hostilities.
The Doctor makes contact with Rory, Mo's wife Ambrose, and Ambrose's father Tony, reminding them to keep their captive Silurian, Restac's sister Alaya, alive. They are unaware that Ambrose has already killed Alaya because she would not help Tony, who she had infected with Silurian venom. The Doctor arranges a "conference" between the Silurians (represented by Eldane) and the humans (represented by Amy and Nasreen); the three discuss how both species can co-exist on the surface of the Earth. Ambrose and Tony, worried about the Silurian reaction when they discover Alaya's death, set Nasreen and Tony's drill to burrow further and self-destruct fifteen minutes after they depart, which would destroy the Silurian oxygen supply and kill them all.
Meanwhile, Restac has killed Malohkeh for his betrayal and awakened other members of the warrior caste, intending to stage a coup against Eldane. When Rory and the others arrive with Alaya's corpse, Restac becomes furious and orders the humans' death; the Doctor disables their weapons to give him, Eldane, and the humans time to escape; they bar themselves into Malohkeh's lab. The Doctor and Eldane realise they can use Silurian technology to destroy the drill before it detonates, but it will cause their exit route to collapse if they cannot reach the TARDIS in time. Eldane returns the warriors to hibernation by initiating a "toxic fumigation"; the humans escape, and Eldane hopes that in a thousand years, peace between humans and Silurians can occur. Tony, still affected by Silurian venom, opts to stay behind to be cured, and Nasreen also remains behind to study the earth from below and help improve human-Silurian relations.
Ambrose's family takes refuge in the TARDIS, but the Doctor, Amy and Rory find a crack in the cavern wall similar to those they have seen before. The Doctor surmises that the crack was caused by an explosion in time, which might have left "shrapnel" behind. He reaches in and pulls out an object which he wraps in a handkerchief. Before he can explain, Restac, dying from the toxic exposure, crawls around the corner and fires at the Doctor, but Rory pushes him out of the way and takes the shot, dying in Amy's arms. As the crack begins to absorb Rory's body, the Doctor realises that Rory will be written out of history and forces Amy to board the TARDIS before the drill explodes. He tries to help her concentrate on remembering Rory, but a jolt from the TARDIS causes her to lose concentration and her memories of Rory are lost. The Doctor finds Amy's engagement ring, which Rory had stowed before the events, on the floor of the TARDIS.
On the surface, Ambrose thanks the Doctor for not letting the Silurians execute her for killing Alaya, and the Doctor asks her to help prepare humanity for their next encounter with the Silurians. The Doctor and Amy return to the TARDIS, where Amy sights her future self on the hillside without Rory. The Doctor takes out the object he pulled from the crack: a burnt piece of the TARDIS's sign. He worriedly compares it to the real thing. Aside from the damage, they appear identical.