Timmy Turner makes his millionth wish which all of Fairy World has gathered to celebrate. But after reviewing his wishes, the Fairy Council finds that Timmy should be put on trial for being the worst godchild ever! Wanda, Cosmo, and Poof think they can prove that Timmy's a good kid, until the truth comes out—Timmy has made a secret wish that Wanda, Poof and everyone else can not know about besides Cosmo, who forgot about granting it.
Timmy is doing his last batch of wishes to reach a million, which include giant bacon, giant balls, a unicycle riding bear and his own team of groupies, although Timmy secretly made a wish about himself and everyone else on Earth to stop aging so that he can stay ten years old and keep his fairies forever as extra which makes a million and one. Once the millionth-and-first wish is made, Jorgen Von Strangle appears because he heard about the giant bacon, and not long after they all go to Fairy World to begin a celebration. Jorgen begins to sing the theme song, only to be shut down and have Timmy and his Fairies sing their own musical number, "A Million Wishes".
In Fairy World, there is a parade to celebrate all of Timmy's wishes, and the first thousand showcase the fires he caused, the following thousands show hurricanes, floods, some plagues, but Jorgen assures Timmy that the Fairy Council is inspecting all of them only to make the parade balloons and that Timmy shouldn't worry. Next Timmy is immediately in jail.
Timmy gets to have a trial on whether or not he is "the Worst Godson Ever", but Cosmo is his lawyer, and to make matters worse, Foop is the prosecuting attorney. To top it off, Cosmo accidentally brought stacks of evidence against Timmy. Foop reasons that if Timmy loses then that means Poof would no longer exist because all of Timmy's wishes would have to be undone. Foop also chose to become an attorney because he wanted to be even more evil.
Wanda begins to call various witnesses to the stand, past wishes that were brought to life by Timmy. The first to be called is the Crimson Chin, who appears to have been in the middle of a bath when he is called as he is poofed into the room wearing nothing but his mask. He speaks in favor of Timmy at first, but then Foop shows the bad that Timmy caused to Crimson Chin, including turning his girlfriend evil and making him realize he is not actually real, Crimson Chin starts crying and says that he's taking a bath to wash away the sorrow of knowing he's just fiction.
Other wishes include Dark Laser, and Mark Chang. The Council decides to see all the good Timmy has done, which includes helping his mom win the Miss Dimmsdale contest to make her feel pretty, as well as the same thing for his dad. The most important wish however, is how Timmy wished Poof into existence. The council is brought to tears by this, and is about to rule in favor of Timmy, until Foop scrambles through Cosmo's stack of evidence and then finds a document labeled "Timmy's Secret Wish!".
As Foop reveals the document to the council, they explain that a secret wish is the ultimate violation of Fairy Law. They state that all wishes must be documented and accounted for, otherwise, godkids could secretly alter the laws of nature, and Jorgen shows a clip about the last one made in December 19th, 1986 by a godchild named Joshua Applebee who secretly wished for Chuckles the Fairy Eating Cockatiel, which also caused massive destruction with its super powers, while telling about it. Timmy admits that he made a secret wish and that he wished that Cosmo would forget granting it and he reveals what he secretly wished for. When the council asked him when this wish was made, Timmy replies he made it over fifty years ago.
Before the council makes all of Timmy's wishes undone, including Poof, Foop begins to celebrate, until Jorgan points out to him that as Poof's Anti-Fairy counterpart, which means if Poof disappears, he disappears as well. The council sends Cosmo and Wanda back to Fairy World while wiping their memories of Poof. They call for Father Time and he sets things right by advancing time on Earth fifty years. Everything, along with Timmy and everyone else on Earth, except for those, including Crocker, who have lost their fairy godparents for breaking any of Da Rules, is fast-forwarded fifty years. Its places, including Dimmsdale, have now changed to resemble Jetsons-like futuristic types.
Timmy wakes up, sixty years old (but still roughly the same size) on his bed, living with his senile parents. Nobody in the world really knows what's going on, and they are all making their homes and artifacts blow up since the technology is beyond their understanding. Timmy also runs into Vicky, Chester, and A.J., all of them aged into senior citizens. Crocker is not affected because the trauma caused to him on March 15 caused him to prematurely age, and his normal appearance is really his "elderly" appearance, although he and Timmy constantly fall asleep.
Timmy remembers that Crocker obsesses about fairies, and Crocker recalls thinking Timmy has fairies. They go to the Crocker Cave to find answers, where Crocker reveals a portal to Fairy World which does not work because it keeps burning the test subjects. Timmy sees that the machine is simply set to the surface of the sun rather than Fairy World, and corrects the mistake, allowing him and Crocker passage into Fairy World. They both spaz out (while drifting off to sleep in between) at the sight of fairies.
Crocker and Timmy find Cosmo and Wanda easily, as no fairy really seemed to be bothered that two humans were there. Once there Timmy makes Cosmo and Wanda remember who he is and that they have a child, though their memory is still fuzzy that they think their baby was a daughter that is square, green and named "Zeke". Cosmo and Wanda also restore Timmy back to his ten year old self. They go confront Jorgen about Poof's disappearance, and see that Jorgen has become morbidly obese and eating frosting because of the grief that undoing Poof caused to him. Jorgen explains that the council didn't allow him to tell Cosmo and Wanda about their kid, Poof, and he lamented that a lot. After a discussion, Jorgen reveals that there's a place where undone wishes go - the Hocus Poconos - and they can go there but don't have much time.
In Hocus Poconos we see Poof, Foop, Crimson Chin and Dark Laser talking a little; Poof's magic is useless there. Once in, Jorgen shows that they have a small window of time to get out (represented by a literal closing window). Some gnomes with Scissor Hands are menacing Timmy's wishes, but Timmy and his companions come to the rescue with the bear and the cheerleaders from earlier in the episode. They save everyone with Crimson Chin's theme playing during the fight. The giant bird that was mentioned as the previous disaster Secret Wish before Timmy's shows up and blocks the exit window. In order to allow everyone else to escape, Timmy draws off the bird.
Shortly after appearing back in Fairy World, Cosmo, Wanda, and the rest are brought before the Fairy Council, who are mad at the fairies going to Hocus Poconos. They all testify on how Timmy sacrificed himself and how good he is. Foop tries to appeal to them, but Poof just says something and the council agrees to save Timmy. Timmy explains that he made the secret wish because he doesn't truly want his fairy godparents forever, but he just wants them forever along with Poof, which he somehow forgot to add. He states that they are his family and that it's not about the wishes he says and doesn't care if can't make wishes anymore. Cosmo, Wanda and Poof then gave Timmy a hug, which made the Council cry happily together and overturn their previous court ruling, stating that he is not "The Worst Godkid Ever" after all, and allow him to have his fairies back. Father Time sets time back fifty years, and everything and everyone on Earth is back to the way they were before Timmy made his secret wish. He then learns his lesson of how he should never make a secret wish ever again.