I came across a Windows 7 machine that kept logging on with a temporary profile, after i removed the profile folder in C:\Users, after a bit of digging it was due to a registry key being wrong, this key is located in.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList in here you will see an entry called S-1-5-21 with the extension .bak i deleted this key and rebooted it then generated a new profile properly.
I have also seen this happen on Windows 2008 Terminal Servers.