I've had exactly the same problem, twice!
The first time it happened, I thought it was a hard drive failure, so did Apple Care and the drive was swapped out for a new one. I got it back, restored from my back up and everything was fine. Went to reinstall Xcode4, same thing happened, icons and apps disappeared, I thought this was the 2nd drive to fail. Apple Care took this very seriously, sent it for a priority repair, this time they were able to reinstall the OS, said the user data was gone, but everything checked out fine. Engineer thought it was a software issue, I mentioned Xcode4, he hadn't heard anything about it.
Machine came back, restored from Time Machine via Migration Assistant again. When it finished, had a number "1" added to the name of my Home Folder and loads of permissions issues, iDisk, system folders, iPhoto, all needed sorting.
Possibly a side issue, but couldn't boot from a commercially purchased Install DVD. DVD drive could read it, I could run access everything while booted up normally, system could see it was a bootable disk, but when I tried to boot from it (every possible way), the DVD would spin a bit and then stop and I would be stuck on the Apple Logo boot screen.
Spent nearly an hour on the phone with Apple Care, guy was patient and helpful, but couldn't repair permissions or boot from the DVD, even tried cloning the DVD to a flash drive. System saw it was bootable, even in Start Up Disk System Prefs, but couldn't get it to boot. Apple guy thought it might be a problem with my DVD copy, corrupted data or something, which would prevent the original DVD and cloned flash drive from working. He's sending me a replacement copy, which will take a week to arrive. He may be right because I can read other DVDs and can even read the install DVD to a point, just can't boot off it. Will try new disk, if it doesn't work, could be trip 3 to the repair shop.
Still needed to repair permissions while boot volume wasn't mounted, so spent 4 hours cloning my drive to an external HD with SuperDuper. It worked, was able to boot from it and repair the remaining permissions that needed fixing. Rebooted from the internal drive and all is good.
Once I get the DVD issue diagnosed, I will phone Apple Care again, my case is still open. Will point out this thread and make the impress upon them as strongly as possible that I believe all of my issues are down to Xcode 4, they have paid for 2 expensive repairs (including courier collection and delivery) that would not have been required if the Xcode 4 installation didn't kill my iMac.
I've spent nearly 3 weeks dealing with this, while not having my iMac. I am still very upset about it. Commiserations to anyone who has had to deal with this very annoying, depressing problem.