Here's how Spencer helps the others in Thomas' Place as a Prime.
Princess Celestia: [has her student in a hug]
Twilight: I can't believe it! Thomas is gone, Spencer's gone bad. Now the world's doomed! [resumes crying]
Princess Celestia: I know, we must stop him ourselves!
Steam Mech: [knocks on Celestia's head gently] Hello! Is anyone home?! Only a Train-Prime can Defeat Megatrain!
Peter: We have to try!
Steam Mech: But how? We don't have Thomas!
Sylveon: Shouldn't we try to get to a shelter?
Brian: No. It wouldn't matter.
[Then they heard Spencer's whistle]
Princess Luna: Hmm?
Wreck-it Ralph: YOU!
Spencer: Hey, wait it's not what you think.
Twilight: What do you want? You have another evil insult to throw at us?
Spencer: Megatrain, tricked me! He lied to me about us being partners.
Fluttershy: So, Megatrain pulled a trick on you?
Twilight: [shedding tears] What does it matter now?! THOMAS IS GONE!!! AND THERE IS NO WAY WE CAN STOP MEGATRAIN!!
Brian: We're all out of ideas!
Spongebob: [looks in the crater] LOOK! HE'S SAFE!!
Twilight: No, Thomas is not safe Spongebob! HE'S GONE!!!!
SpongeBob: No, really guys, He's safe! He's safe! He's safe! Sa-a-a-fe!!!
Squidward: Will you cut that out?!!
SpongeBob: [to a conga beat] Safe, safe, safe, safe! Safe, safe, safe, safe, safe, safe, safe, safe, safe! [rips himself apart then the two parts go in circles and then they connect again. SpongeBob starts doing a conga dance] Safe, safe, safe, safe, safe, safe, safe, safe, safe, safe, safe, safe, safe, safe, safe, safe, safe! Safe, yes he is safe!
Edd: Sponge, what are you talking about?
SpongeBob: Look in the crater!
[everyone looks down in the crater]
Edd: No, it can't be!
[we view the inside of the crater and see Thomas is perfectly unharmed]
Thomas: Huh? [looks up]
Spongebob: Thomas is fine! [starts crying happily] He's safe! SAFE! [jumps down the crater only to hit something and bounce back]
Applejack: What in tarnation?
Thomas: I'm okay!
James: [stutters] HOW?!
Mucker: Wait a Minute. [drops a tiny stone and it bounces back]
Edd: The Matrix and the gems must've put a shield over Thomas before Tirek's blast hit him.
Sergeant Calhoun: D's, correct!
Ed: HAPPY DAY!! HAPPY DAY!!
Thomas: [comes out of the crater]
Twilight: [kisses Thomas] You came back!
Thomas: I was never gone, I was in the crater the whole time.
Spencer: I know where Megatrain's machine is!
Princess Celestia: You do?
Spencer: Yeah, it's inside the tallest mountain just beyond here!
Princess Luna: We must stop Megatrain!
Thomas: But I'm not a robot.
[then a beam comes down from the sky]
Eugene Krabs: Oh no, is there another evil guy comin'?
Brian: Hit the dirt!
[The beam hits]