The Doctor knows that the Darksmiths are no longer a problem because they have finally delivered their commission to the Krashoks. But now the Krashoks have a device which can bring their fallen soldiers back from the dead. Fortunately, Gisella has sabotaged the Eternity Device by putting in the fake Crystal. Unfortunately, she is aboard the Krashok ship with the real Crystal in her possession. Somehow the Doctor must track the ship down and rescue her. His only clue as to where they may have gone is the witch’s cryptic message about the brightest of the young. Suddenly it hits him that the Krashoks can’t use the Device until it has been calibrated to only raise their own dead. In order to do that they would need technical help with the calibrations, and they can’t go to the Darksmiths after they murdered the Darksmith envoy. The Doctor starts to work out where they might go for help.
Meanwhile, Gisella is making her way around the Krashok ship, looking for a safe place to hide. Most of the troopers are in the barracks and so she only has to negotiate her way past the service robots on board but none of them seem to acknowledge her presence. She eventually makes it to a storage area and hides behind some shelves. Soon after, the engines begin to slow and she peers out of a window into the blackness of space. The ship turns and she sees a huge brain floating in front of her.
The Doctor realise that there is only one place where the Krashoks can go for the help they need and sets the TARDIS controls. He is going to find the brightest of the young on the Space Brain, a school for the most gifted children.
The Krashoks have detected an unknown life form on their ship and are organizing a thorough search. Gisella overhears their commander issuing instructions for the search even as the ship is docking.
The TARDIS materialises in the middle of a classroom on the Brain. The children are excited to see teleportation being used in front of their eyes (they studied it the previous week) but the teacher, Professor Apricott, is less than happy about the intrusion. The Doctor produces his psychic paper to show that he is a school inspector and the professor gives him two children, a girl and boy called Caffey and Kleb, to give him a guided tour. The Doctor makes his way through various classrooms, pretending to be interested in the lessons while really looking out for Krashok involvement.
Gisella tries to sneak off the ship but is spotted by two guards. She hides in a sub-control room but is soon located. While the Krashoks break the door down she removes a panel from the wall and creeps through a wiring conduit. When she removes another panel and emerges in a different room she finds a group of Krashoks, including Sergeant Jorak, waiting for her. She is taken to Commander Grelt who is so pleased he promotes Jorak to Acting Commander. The Krashoks search Gisella and soon find the real Eternity Crystal. Grelt orders a test of the two Crystals in their possession in order to identify the real one. He then orders a mind probe to be used to extract Gisella’s knowledge before she is executed.
The Doctor observes that the teachers and lessons on the Space Brain are excellent but the place itself is rather run down. Kleb says the problem is a lack of funding. The pupils even had to pay for their own trip to the Museum of Windows to see the exhibition on the Defenestration of Prague. The Doctor drops in a line that says he was present at the time and saved the lives of the victims with a pile of manure. He then asks to see the Principal. However, when they get to the Principal’s office the only occupant is a Krashok and an airlock in the room is attached by a transparent tube to the Krashok ship.
The Doctor tips up the desk in the room and knocks the alien warrior backwards before grabbing the children’s hands and making a run for it. As they sprint down the corridor he tells the children that the principal is probably dead and that there will be a lot more Krashoks about. He says that they have come to the Brain for help solving a problem. Kleb tells him that there is a lot of new equipment in the science lab and that the children have been working on some very difficult problem solving tasks. The Doctor fills in some details about the Eternity Device’s ability to raise the dead. Caffey asks him what his plans are and the Doctor says he needs to warn the staff and pupils and then rescue Gisella and, finally, defeat the Krashoks.
In the staffroom he tells the teachers that there are dangerous aliens aboard the Brain and that they have killed the principal. In the distance, explosions can be heard. The teachers are incredulous at first, but when Caffey mentions Krashoks an elderly teacher, Mr. Gershwinn, recognises the threat. The Doctor leaves the teachers as they set out to marshal the pupils into the Assembly Hall where they can try to defend themselves. He makes his way down the corridors until he comes across a Krashok search team. They are checking rooms by throwing grenades through the door and then entering to look for survivors. The Doctor finds it easy to sneak past them and get back to the Principal’s office.
He makes his way across the tube to the Krashok ship and locates a terminal nearby that gives him a schematic of the ship’s interior. Using a high-pitched signal from the sonic screwdriver to interfere with the service robot’s optical systems, he finds his way to the cell block. There, he sees Gisella. She is strapped to a bed and attached to a bank of equipment by a mass of tubes and wires.
Working quickly, he reloads the information the Krashoks have taken back into her brain and then detaches the wires. Gisella tells him that the Krashoks have the real Crystal so they set out to find and sabotage the Eternity Device.
They find it in a huge, dark room – the Eternity Chamber. The Eternity Device is a massive piece of equipment and at the heart of it is the Crystal. The bright blue glow from the Crystal tells the Doctor that the Krashoks have replaced the fake Crystal (it wouldn’t be able to withstand the demands on it) and the machine is being powered up. He bends down and picks up the fake Crystal, discarded on the floor. He says that when the calculations are completed the machine will have to be powered down and reset. When that is happening he will have the opportunity to switch the Crystals again. Before that, however, he intends to make sure that the calculations are never completed. They hurry back through the ship to the airlock but are seen by three Krashok troopers.
Before they can escape two more warriors come from the opposite direction. It looks as though they are trapped until an explosion behind the Krashoks sends a cloud of black smoke rolling through the corridor. The Doctor takes Gisella’s hand and leads her through the smoke past the Krashoks and into clear air on the other side. Inside the smoke they hear blaster fire as the Krashoks start shooting each other.
At the airlock doorway they see Caffey and Kleb. The boy explains that the smoke was his doing, made in the chemistry lab.
The Doctor tells the three children to return to the Assembly Hall. On their way they are to disrupt the Krashoks as much as possible and try to hack into the Krashok systems using the fibre optic links under the floor of the hall. He is on his way to the physics block to try to sabotage the Krashok equipment and prevent the calculations from being completed.
The children approach a party of Krashok soldiers. Kleb flings his last smoke bomb before the soldiers can fire their weapons and the three of them run through the smoke, past the soldiers. Gisella and Kleb emerge on the other side but hear a scream – Caffey – from the smoke. They wait anxiously until she finally appears and then they hurry on their way.
Their efforts at disruption make the Krashoks think that they are under attack so that troopers are being sent to offer support. This leaves the way clear for the Doctor to reach the main laboratory where the Krashok processors show they are only three minutes forty-two seconds from completion. Before he can do anything the Doctor is apprehended by a trooper and Commander Grelt. The Commander tells the Doctor that his execution can wait until he has seen the successful completion of the Krashok victory. The Doctor yawns in response.
In the Assembly Hall Mr. Gershwinn shows Gisella a display that shows the Krashoks and the Doctor leaving the Brain. Obviously, the aliens have got what they came for.
Back in the Eternity Chamber again, the Doctor watches as the Krashoks shut down the Device so that it can be calibrated. As the only light source in the room is the glow from some monitor screens and the Crystal, the powering down plunges the room into darkness. The guards holding the Doctor release him briefly to switch their visual circuits to infra-red. Taking his chance he runs to the Device. No sooner has he reached it than he is grabbed again by his guards. Just then the lights come on; blinding the guards and the Doctor reaches for the Crystal. A massive cybernetic hand slaps him away and the Doctor finds himself lying on the floor while Grelt towers over him.
Grelt order the Doctor’s execution but before the guards can shoot him the lights go off, followed by a series of bright flashes. The Krashoks can’t adjust their eyes quickly enough to the dark-light-dark sequence. Gisella calls to the Doctor and he follows the sound of her voice to the door. Kleb, Caffey and Mr. Gershwinn are waiting for him. They explain their trick was to use magnesium powder from the Chemistry lab. The Doctor says they have to stop the Device before the calculations are downloaded and Kleb says he thinks he knows a way to do it. The five of them run back towards the Assembly Hall but by now the Krashoks are in pursuit.
In the main corridor near the hall the small group is in danger of being overtaken by the warriors. However, the other children and teachers have set up a series of traps: trip-wires to bring down the pursuers; an area of floor where the plates have been all-but removed; buckets of cooking oil and half-set jelly. As the Doctor and his friends race by the traps are sprung in sequence until the Doctor, children and teachers are all safely locked in the hall. Kleb sets to work creating a computer virus to corrupt the Krashok system but has barely begun when an explosion dents the door from outside.
Kleb announces that the virus is running just as the door gives way and Grelt leads his men into the hall. Grelt singles out the Doctor, Caffey, Kleb and Gisella and orders that they return to the ship with him. He says the other teachers and children will be dealt with as he sees fit. The Doctor orders him not to harm them. Grelt is outraged that someone should give orders to a Krashok so the Doctor tells him to see it as a warning and adds that there won’t be a second one.
In the Eternity Chamber the party stands around the Eternity Device, hoping that the Krashoks haven’t spotted the virus. Soon, a technician is ready to upload the calculations when he announces that he has detected the virus and quarantined it. The Device is finally ready. Kleb is distraught but the Doctor turns to Grelt and warns him one last time not to begin the activation. Grelt merely smiles as he gives the order to proceed. The Doctor then tells the Krashoks that he is sorry and produces the real Crystal from his pocket, telling how he switched it for the fake when the lights went out earlier. Now there will be an energy blast from the Device that will kill only Krashoks.
The Doctor tosses the real Crystal into the Eternity Device. He tells Gisella that this is the only thing that can destroy it as her father knew. He leads his friends through the Krashoks, who are all clutching their heads, and back to the Space Brain. Jorak’s last act is to demote Grelt to the rank of trooper as the Device sends out a wave of energy that turns the organic components of the Krashoks to dust. It is the same in the Assembly Hall, where suits of Krashok armour collapse as their inhabitants disintegrate. The Device explodes, taking the Krashok ship with it.
The Doctor stands outside the TARDIS, saying goodbye. Gisella announces that she wants to stay on the Space Brain to add to her education. The Doctor is surprised and saddened but she tells him to visit her and tell her of his adventures. Maybe, one day, she will travel with him again. After a brief farewell the Doctor, covering his emotions, steps into the TARDIS and dematerializes, leaving an awestruck Caffey and Kleb with Gisella.