Here's when Optimus assigns Thomas to protect the Matrix, Blue Ruby and Black Pearl in Thomas' Place as a Prime.

Optimus Prime: Thomas.

Thomas: Yes, Optimus?

Optimus Prime: I knew that Tirek has returned.

Thomas: And?

Optimus Prime: The Princesses sent Mako and Spencer to spy on Tirek earlier and Mako found out Tirek's plans.

Princess Luna: He wishes to use the Matrix of Leadership to bring back Megatrain's army. 

Thomas: So what are we gonna do?

Optimus Prime: That is why you must protect the Matrix.

Thomas: Why?

Optimus Prime: Cause Tirek will want to get the Matrix With Ernie by his side, they will rule the world and the universe.

Thomas: Can't someone else do it?

Optimus Prime: No Thomas, you have to do it. Only a Prime can take the Matrix.

Princess Celestia: Tirek doesn't know that you're a Prime, so you have to do it.

Thomas: Okay.

Optimus Prime: But you must also protect the Blue Ruby and the Black Pearl as well.

Thomas: I thought Tirek couldn't steal magic anymore.

Princess Celestia: He can't but we can't risk him receiving the most powerful gems in the world.

Optimus Prime: So what will it be Thomas? [he takes the Matrix out of his chest]

Thomas: I'll do it!

Optimus Prime; Now, Listen to me Thomas, do not let Tirek and Ernie have the Matrix or the gems for anything! Even if it means making a sacrifice.The world will be doomed if you do so. Understand?

Thomas: I understand.

Optimus Prime: Good. [he place the Matrix and gems into Thomas]

[Thomas soon puffs away]

[With Ernie and Tirek]

Tirek: [sniffs] It's Canterlot. We're getting close.

Ernie: Once we ge the Matrix the universe is ours!