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 Cosmo, Wanda and Poof forever as an extra from a loophole of one of Da Rules, 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 Fairy Godkid 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 Timmy to be executed.
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 every wish must be accounted for; otherwise godchildren could secretly alter the very fabric of the universe, 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, forgetting to add Poof. When the council asked him when this wish was made, Timmy guessed 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, though it is truly no thanks to Timmy. They call for Father Time and he advances time on Earth fifty years. Everything, along with Timmy and almost everyone else on Earth is aged fifty years, as Father Time said, in the blink of an eye. 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, not even Timmy, really knows or cares what's gone 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, 1972 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 that he is really himself, by guessing that Cosmo dresses like a princess and pretend to rule a bathroom when Wanda goes shopping, which was really their secret, and that they have a child, though Cosmo's memory is still fuzzy that he thinks Poof was a daughter that is square, green and named "Zeke", after he restores Timmy back to his ten year old self. They go confront Jorgen if they really have Poof as Zeke, 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, Poof and the rest are brought before the Fairy Council, who are mad at them about going to Hocus Poconos and about to punish them. Wanda testifies on how Timmy sacrificed himself and how good he is. Foop tries to appeal to them by demanding a retrial of Timmy, but the Council denies it. Poof then just makes an argument, and it makes the council agree to save Timmy from the Hocus Poconos and begin his retrial. He explains that he made his secret wish so that he could forever have Cosmo, Wanda and Poof, now that he remembers to add him, and that it is because he can not imagine life without them, states that he does not care if he does not ever get to make another wish anymore, begs just not to take them away from him and proclaims that they are his family, which is because it is about something important than the wishes he made. Cosmo, Wanda and Poof then give Timmy a hug, which makes the Council cry happily together while hugging each other and overturn their previous court ruling, after proclaiming that he is not the Worst Fairy Godkid Ever, by allowing him to have his fairies back. They call for Father Time again and he sets time on Earth 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.