This is how Optimus and Twilight return goes in Orion Pax and Nightfall Twinkle Part 3.
Megatron: Come, Arcee and Rainbow Dash. So that I might end the lineage of the Primes and Princesses for all time.
Orion Pax: We cannot allow that to happen, Megatron.
Nightfall Twinkle: What he said.
[Orion deploys his swords and Nightfall readies her magic]
Megatron: And why should you care, Orion Pax and Nightfall Twinkle? You are no Prime or Princess.
Orion Pax: That may be true. Or yet another deception?
Nightfall Twinkle: But this much we do know: Our sympathies lie with the Autobots and Ponies and you are not one of us.
[They glare at him]
Megatron: Your spark and heart may be at the right places, Orion and Nightfall. But you have much to learn before you can hope to ever again stand your ground against me. A moment, sadly, which shall never come.
[Arcee and Rainbow Dash come through the Space Bridge and Arcee transforms to robot mode and tackles Megatron. Orion and Nightfall look at Rainbow Dash, who brings up the Key to Vector Sigma. Orion and Nightfall look at each other]
Orion Pax: Are you certain we're worthy?
Nightfall Twinkle: Are you sure?
Rainbow Dash: You have no idea.
[The two friends look at Rainbow Dash. Rainbow Dash holds up the Key to Vector Sigma which fires a beam at Orion's chest and Nightfall's horn and Orion's chest opens up to reveal the Matrix of Leadership]
Megatron: How nice of you to join our tender reunion. Now, if you please the Matrix and the Alicorn magic?!
[Megatron turns his head to see Orion Pax and Nightfall Twinkle regaining their memories as Optimus Prime and Princess Twilight Sparkle]
[Megatron brings his blade down on Optimus Prime and Twilight Sparkle, but Optimus catches it]
Optimus Prime: Megatron... Be gone!
Twilight Sparkle: Rust in peace in Tartarus!
[Bumblebee, Rarity, Ratchet, Pinkie Pie, Bulkhead, Applejack, Arcee, Rainbow Dash, Fluttershy, Princess Celestia, Princess Luna, Princess Cadance, and Shining Armor watch in amazement as Optimus Prime and Princess Twilight beat Megatron]
Optimus Prime: Ratchet! How did we arrive here?
Twilight Sparkle: Princess Celestia.
Ratchet: It's kind of a long story.
Princess Celestia: Twilight!
[Twilight and Princess Celestia hug]
Twilight Sparkle: I'm glad to be back.
Princess Celestia: I'm glad you're back too.
Shining Armor: Twily!
Twilight Sparkle: Shining Armor!
[Shining Armor and Twilight Sparkle hug each other]
Shining Armor: I missed you so much.
Twilight Sparkle: I missed you too.
[Autobot Groundbridge opens up]
Arcee: It's ours let's go.
[Arcee and Rainbow Dash enter the Groundbridge]
Bulkhead: This time they're coming with us.
[Everyone enters the Groundbridge and it closes, leaving Megatron to scream in outrage]
[Everyone returns to Autobot Outpost Omega One and see Optimus Prime and Princess Twilight enter]
Starlight Glimmer: Twilight?
Optimus Prime: Hello my young friends.
Twilight Sparkle: Hey, girls.
Rainbow Dash: They remember us.
[Optimus and Twilight look at their Decepticon insignias replacing Optimus' Autobot insignia and Twilight's cutie mark]
Optimus Prime: It seems there's much we don't remember.
Twilight Sparkle: Yeah.
Ratchet: But at least you two are the way you were before.
Princess Celestia: And also, Optimus, you've learned your first friendship lesson.
Optimus Prime: I have?
Princess Celestia: Yes.
Optimus Prime: What was the lesson?
Princess Celestia: When one loses their memories, they should not listen to an evil enemy's lies.