Meanwhile, Thor was in time-out on Midgard. He was learning lots of important lessons there. That not everyone is as powerful as him- that everyone has problems- that politeness is important- and, after Loki made him sad with lies to keep him away, that he hadn't been his best.
He thought about things and talked to people, and realized that violence isn't always the answer. He realized that listening to people is important, and the way he acted his whole life was wrong. He thought a great deal, and fell in love with a human named Jane Foster along the way.
After all that thinking, his friends the Warriors Three and the Lady Sif arrived.
Among them was Frigga's pawn.
But before the pawn could complete their mission, the Destroyer attacked!
Loki found out that the irresponsible Gatekeeper had let Thor's friends visit him in time-out, and was angry! So he sent the Destroyer robot to keep Thor from coming back.
There was a big fight, and several times the Warriors thought they had one- like when Sif punched a spear right through the Destroyer's head! But the Destroyer was built to last, and kept going.
With all the townspeople evacuated, the Destroyer, under Loki's control, turned to Thor and his friends.
Thor realized Loki wanted him, and only him. Thor told his friends to go, but they stayed- because good friends at least hang around when their friends to stupid things to offer first aid when it goes bad.
Thor told Loki that Loki could kill him, if he'd leave everyone else alone- (they'd grown up being taught that mortals were lesser, weren't as important, but Thor learned differently in that time)
Here is where you can't quite tell what Loki intended. He turned the Destroyer away from Thor, and then backhanded Thor sharply. It could've been that he meant it as a 'but I don't forgive you!' to the 'I won't kill you...' and forgot the fragility of mortal bodies (as Sif said, it's been at least a thousand years since they visited Midgard) and that's what I think- but he also could have really meant it.
Which is bad. Don't try to kill your siblings.
But Thor, being willing to sacrifice himself for 'lowly' midgardians, earned the right to wield Mjolnir again- his powers came back. Time-out was over.
Thor made a tornado that destroyed the Destroyer.
and in that moment, he was a Big Damn Hero.