This is the scene for Tirek's request and where Thomas is seemingly killed in Thomas' Place as a Prime
Thomas: I'm listening.
Tirek: Give me and Ernie the Matrix, Blue Ruby, and the Black Pearl. And I'll let you live to be my personal train.
Ernie: Or lose your pals.
Thomas: [looks to his friends for an ideas]
Percy: Don't do it.
Toby: Thomas, don't listen to him.
Rainbow: Don't do it!
Applejack: Yer' our friend T!
Princess Celestia: Listen to Optimus' advice!
Twilight: THOMAS, PLEASE DON'T DO IT!!!!
Ernie: Shut your mouth! [shots lightning out]
Thomas: [thinks for a minute]
Optimus: [in Thomas' mind] Listen to me Thomas, do not let Tirek have the Matrix or the gems for anything! Ever if it means making a sacrifice.
Ernie: What is it going to be, Thomas?
Thomas: NO!! I'M NEVER LETTING YOU HAVE THEM!!! Optimus Prime has taught me a lot of things, but if there is anything he taught me; he's taught me the code of the Primes. As a Prime it is my duty to protect others ever if it means making a sacrifice. Besides, a good Prime puts his friends' lives before his own, and as a Prime I'm willing to do that. If it means losing my life, then so be it.
Brian: That was the best speech I ever heard.
Tirek: [in Megatron's voice] Oh, so unwise. [he readies a blast in his horns]
Thomas: [closes his eyes, ready to accept what's coming to him]
Brian: Oh, my God!
Vanellope: No, no. No, no, no, no! NO!! NO, PLEASE TIREK!!!
Ernie: Kill him!
Tirek: [fires his blast and it hits Thomas]
Edd: Good lord!
Princess Celestia: Thomas!
Princess Luna: No!
[after the dust clears, there is no sign of Thomas]
Brian: [as Frodo] NOOOOOOOOOOOOOO!!!!!!!!!!!!!!!!
Ed: GASP!! THAT MUTANT VAPORIZED THOMAS!!
Twilight: [her eyes start tearing up then she starts crying]
Vanellope: [crying] You really are a jerkinator. [continues crying]
Tirek: That's right, glitch.
Ernie: [chuckles] He's gone. Sorry for your boyfriend, Twilight. He's history.
Twilight: No, no. [falls to her knees]
Vinny: [pulls out his shotgun] Kill him! [he starts shooting Tirek]
Tirek: AAAHHHH!!! YOUR CRAZY MUTT!!!
VInny: YOU KILLED THOMAS!!
Ernie: Yeah, that's the point, where evil.
Brian: [looks a the crater] He's really gone this time!
Peter: I don't believe it!
Twilight: Now I lost the one true thing I love most of all!! No, no. NOOOOOOOOOOOOOOOOOOOO!!!!!!!!!![cries loudly over the loss of her tank engine]
Brian: We just lost a great friend. [a tear streams down his cheek]
Mucker: Yeah, but you just destroyed your keys to getting the army of Deceptitrains.
Tirek: I don't care, I'm am still powerful enough to take over the world!
Ernie: And me as well!
[they cackle then they all hear a blast]