Based on the last few seconds show, it seems that Glida was behind this.
Also, I have a feeling that Princess Celestia is the real Mia. I know Phoenix Wright believes that Sonata is, but given that Princess Celestia knows so much about Wright, it only seems to make sense.
Also, WHY THE CUPCAKE REFERENCE!!?? WHY??!
Finally, what "Thing" is Pinkie Pie messing? Well, anyone who has read Shakespeare surely knows that "Thing" she is referring to.
Of course, the true Villian is Derpy Hooves!