So Loki becomes King of Asgard when Odin has some type of heart attack. He has also found out the story of his birth - that he is really one of the Frozen people.
He visits Thor in a type of vision, to tell him that Odin has died and he is King now - and Odin's last command was that Thor must be banished to protect the peace with the big Freeze.
Loki commands the GateKeeper Heimdall to allow no more travel through the magical gate. Heimdall isn't too happy, and whips out his laptop to get onto monster.com.
Thor's pals of Zena, Jackie Chan, Robin Hood and the big dude decide to break the rules and risk treason by going to Earth to help Thor. The Gatekeeper walks away from his post, allowing them free to travel through, hoping no one will notice. (Although it's quite an obvious ride for anyone in Asgard to see).
As insurance, Loki summons the robot sentry from the artefect room, and sends him to Earth to destroy Thor and anything that stands in his way. Meanwhile, Loki has met with Mr. Freeze and concocted a cunning plan - he will allow Freeze and his boys into Asgard to take their ice artefect to help their world, but in return they must kill Odin in his current state of sleep.
On earth Thor meets his pals and learns the truth about Loki, but the reunion is cut short when the robot turns up. They manage to get the people of the town to safety, and then bravely Thor stands up to the sentry - offering his life in exchange for the safety of those on Earth. Loki, who can hear this, seems to agree to the terms and the robot knocks him out. Jane is devastated.
Just as the robot is about to barbecue the Viking, Thor fulfills his destiny. The hammer shakes a little, erupts from the earth and lands in his outstretched hand. Thor sends into the robot's head, then whips up a thunderstorm and finally destroys the metalhead. Shame as it was a good little machine to have around.
The Freeze People (Frost Giants) have entered the gate to Asgard, and frozen Heimdall. Thor is ready to return. Heimdall manages to break out the ice, kill the bad guys around him and open the gate to the good guys. They help get the gatekeeper to the infirmary, and stop Mr Freeze's plan --- but wait, Loki finishes off the bad guy. It was a double bluff! Loki is still on the side of the good guys, but just wanted to prove himself to his old man. Daddy issues.
Thor is not too pleased when Loki opens the gate to the freeze world and starts to destroy it. They argue, they fight, and Thor wins. The only way to stop the annihilation is to break the rainbow road. Thor gets out his hammer and smashes it to pieces. But this also means he will not be able to see Jane again.
Loki and Thor fight and fall from the broken road, but are saved by a fit-again Odin. Odin is not too proud of Loki, so he lets go and falls off into space.
At a "we saved the world" party, Thor is not his usual self - he is a more reflective prince and misses his girlfriend. Meanwhile, Jane is busy on earth trying to create wormholes.
After the credits ---
Erik is summoned to the vaults of a secret government bunker type building where he meets Samuel L Jackson from The Shield. He is shown an alien power cell that when examined should give the world a new renewable energy source. Loki is seen in a mirror watching it, and he comments that it looks interesting - which Erik then repeats.