At the Deffry Vale High School, Headmaster Finch returns to his office to find a girl sitting outside. The school nurse has sent her there. Upon discovering that the girl has no parents, Finch invites her into his office… and a muffled scream rings out.
The Doctor introduces himself as the new Physics teacher at the school. He immediately rushes into the course and starts tossing out questions. The only one who knows any answers is Kenny, who knows all the answers… including those pertaining to FTL drives.
Later, the Doctor goes to the cafeteria where Rose is working as a lunch lady. She slips over and they discuss the fact that Mickey received reports of UFO sightings near the school and called them in to investigate. The head cafeteria worker notices Rose lingering and tells her to get back to work. When they ask about the food, the woman comments that Finch prepared the meal personally, particularly the chips. As Rose goes back to work, one of Finch’s math teachers, Mr. Walker calls out one of the students.
In the kitchen, Rose calls Mickey and tells him that the math teachers and cafeteria workers were recently replaced. One worker gets oil from a vat on her and starts screaming. The other cafeteria workers get the woman into a separate chamber and the head lunch lady assures Rose that the worker will be okay.
In a darkened classroom, Mr. Walker has the specially selected students sit at computers and put on headphones. He talks of the wonders they’ll see and they all start typing at their keyboards.
Headmaster Finch meets with a reporter, Miss Smith, who is there to do an article on the school and how it’s shown such improved results since he took over. Miss Smith admits that she’s impressed with what he’s done.
The Doctor is in the teachers’ lounge discussing the fact that Finch is new and replaced all of the math and cafeteria staff. The other teacher notes how unusual it was that the Doctor’s predecessor won the lottery… since she never played and someone dropped a ticket through her door. They’re interrupted when Finch comes in and introduces Miss Smith. The Doctor recognizes her as his old companion, Sarah Jane Smith. She doesn’t recognize him in his tenth body. He introduces himself as John Smith and Sarah Jane admits she had a friend with that name once.
In the hallway, Kenny enters the darkened room with the computers. He sees a shadowy figure beneath the desks and it snarls at him from the darkness… and then stands up to reveal Mr. Walker. Walker tells Kenny to leave.
That night, Sarah Jane sneaks into the school, unaware that the Doctor and Rose have returned with Mickey. They split up to search the school and get an oil sample while Sarah Jane investigates the basement and finds a familiar sight: the TARDIS. She turns to find the Doctor waiting for her. He tells her who he really is and she’s glad to see him. They conclude they’re both there to investigate Finch, but Sarah Jane is angry that he left and never returned.
Mickey screams upstairs and the Doctor and Sarah Jane run to investigate. They discover that Mickey has stumbled across freeze-dried rats. Rose arrives and is surprised to see the Doctor with another woman, while Sarah Jane notes that the Doctor has found another young female companion. Rose is happy to tell her that the Doctor never said anything about Sarah Jane. They go to Finch’s office and find that man-sized bat-creatures are asleep and hanging upside down from the ceiling. They quickly leave, unaware that one of the creatures has woken up.
The Doctor needs to go to the TARDIS to analyze the oil sample. However, Sarah Jane explains she has just the thing outside in the boot of her car. She reveals that she has K-9 packed away, and explains that he broke down and she couldn’t get him repaired. They go to a café, unaware that one of the bat-creatures is following them. Finch is perched on a nearby roof, watching them as well. As the Doctor works on K-9, Sarah Jane talks about how he gave her a life of wonders and then took it away. The Doctor tells her that humans weren’t allowed on Gallifrey at the time, but doesn’t say why he didn’t come back later. Meanwhile, Mickey and Rose talk and Rose admits she wondered at first if Mickey made the whole thing up to get her back to Earth. He observes that the Doctor is just like any other guy with two girls vying for his attentions.
The Doctor gets K-9 repaired and it determines that the oil samples belongs to a race called the Krillitanes. The Doctor has heard of them, and explains that they take on the desirable physical properties of the races that they conquered… and discard the rest. As they go back to the car, Rose wonders why the Doctor never mentioned Sarah Jane, and wonders if she’ll be discarded like her some day. The Doctor explains that while humans age and die, he never will. When he says that he’s a Time Lord, Finch overhears him and his minion flies over them before departing.
The next day, the Doctor, Rose, and Sarah Jane go into the school while Mickey is left to wait outside in the car with K-9. Rose and Sarah Jane go to the classroom to check the computers while the Doctor spots Finch. They meet by the school pool and Finch says his real name is Brother Lasser. He prefers human form but his brethren use a morphic illusion to disguise themselves. Finch knows about the Time Lords and is surprised to see one still alive. The Doctor demands an explanation but Finch tells him to figure it out as a test, and says the Doctor will eventually embrace the Krillitane cause. The Doctor warns him that he’s much older and has less mercy than his younger incarnations. He gives Finch one warning to leave off his plan and then departs.
Rose and Sarah Jane work on the computers and Sarah Jane tries to warn her successor about the dangers of being left behind by the Doctor. Rose figures she’s jealous and they start comparing various monsters they’ve encountered. They finally give up trying to wind each other up and start laughing, much to the bemusement of the Doctor when he returns.
Finch tells the Krillitanes that they must seal down the school and initiate the Final Phase. All of the students and human staff are called to their respective rooms. Kenny is the only one who suspects anything is going on. Rose tells the students approaching the computer room to go outside. In the staff room, Finch and the Krillitane teachers tell the human teachers that it’s time for an early lunch, and then start feasting. Meanwhile, Kenny remains outside of the rooms as the other students are herded inside.
Walker hooks up the students to the special computers in the lab and they begin running calculations again. The Doctor, studying the program, realizes what it’s for. Kenny runs through the halls and sees that all the other “special” students are hooked up to the computers and working the calculations. He tries to get outside, only to discover the doors are locked. Mickey sees him and realizes something is wrong, and asks K-9 what they should do. The robot dog suggests Mickey drive through the door.
The Doctor explains that the Krillitanes have the schoolchildren working on the Skasis Paradigm. The Paradigm will give the Krillitanes power over matter and energy, including the building blocks of life. The oil accelerates the children’s intelligence, allowing them to make the calculations. However, the process deprives the children of their imagination. Finch arrives and tempts the Doctor, suggesting that the Doctor could join them and use the Paradigm to do good… and preserve the lives of his companions. The Doctor considers what he’s said, but Sarah Jane insists that all things have their time and must eventually come to an end. The Doctor snatches up a chair and uses it to smash one of the computers.
Mickey smashes through the doors and Finch summons the other Krillitane. The Doctor and the others try to escape through the cafeteria and find Kenny. The Krillitanes break into the cafeteria and attack, but K-9 holds them off while the Doctor and the others seek refuge in a locked door. The Doctor realizes the Krillitanes are vulnerable to the oil they use on humans and heads for the kitchen. He also realizes that their “borrowed” ears are sensitive to loud noises and has Kenny set off the fire alarm. The Krillitane break in but are temporarily immobilized by the alarm. Finch, in his human form, is immune and cuts off the alarm.
In the computer room, Mickey finally pulls the plug on the computers, freeing the enraptured students.
The Doctor gets to the oil vat and sets it up so K-9 can shoot and break it open. K-9 warns that the shot will use up all of his remaining energy, destroying him. The Doctor says goodbye to his long-time companion and then gets himself and the others out, sealing the doors. Finch and the other Krillitanes, in their human disguises, come in and K-9 fires at the vat, splattering them with oil. Finch, unaffected in his “real” human form, approaches K-9, which blows up, killing the Krillitane and destroying the school. Outside, the children cheer.
Later, the Doctor shows off the new TARDIS interior to Sarah Jane and then suggests that she come along. Sarah Jane refuses, saying that she has decided to move on with her own life rather than waiting for the Doctor. Mickey asks if he can come along and Sarah Jane convinces the Doctor to take him on. Rose is less than happy to have her ex-boyfriend with them. As Sarah Jane leaves, she tells Rose that she’ll be there for her in the future when she’s no longer with the Doctor.
Outside, the Doctor and Sarah Jane say a real goodbye. He goes into the TARDIS and departs, and Sarah Jane realizes that he’s left her a present: a new K-9. Together, Sarah Jane and her dog head for home.