It's a known problem that occurs sometimes. I read somewhere it could be caused by using some kde programs in gnome.
Try moving the .ICEauthority file in your homedir or remove it alltogether, a new iceauthority file will be generated.:
Ctrl+Alt+F1
login
Code:
mv .ICEauthority .ICEauthority-old
or
Ctrl+Alt+F7
and try to log into gnome again.