Karnilla, knowing the prophecy of Thor's death fighting the Serpent, was waiting for that moment to come. She allied herself with the troll kingdom and cast a spell to erase Thor from everyone's memories upon his death and replace him with Ulik disguised as a guy called Tanarus. Thor went where all forgotten gods apparently go, which is to be eaten by the Demogorge. But Loki somehow retained some small memory of a loving brother who was definitely not Tanarus. He investigated and started to learn about Thor. Heimdall also started to sense something was not right about Tanarus and investigated. While both of their memories of Thor were strengthening, Thor himself started regaining his memory. Once that process was complete, Mjolnir returned to him and he busted out of the line of gods waiting to be eaten, bringing a couple alien gods along with him. They returned to Earth, Thor killed Ulik, Frigga beat the crap out of Karnilla, and the rest of the Asgardians drove back the troll army. Karnilla and Geirrodur, the king of the trolls, were magically imprisoned in Ulik's skull and sent who-knows-where. So Thor's back.