Here's how Ernie teams up with Tirek in Thomas' Place as a Prime.
[Tirek is getting ready to eat another crystal, when Ernie stops him]
Ernie: Tirek, what's up?
Tirek: Ernie. You're alive?
Ernie: As a bird.
Tirek: I commend you on your survival.
Ernie: I came to restore your youth.
Tirek: How did you...
Ernie: Listen, I heard you are after an "Ark". And I came to your greatness. And I have an idea.
Ernie: If you and I can get that Ark, we can use Megatrain's army to rule the galaxy. And you and I will be the new Sith Lords, and no one can stop us!
Tirek: I like the sound of that.