Which desktop? KDE4 or Gnome? These things can be configured, don’t know about GNOME, but in KDE4 you can make it do whatever you want, through systemsettings - powermanagement. Play around with the profiles and when the laptop should switch to another profile.
Although this seems to be fixed for the asking person someone may have a similar problem in the future.
I had this problem also and found a workaround.
Under GNOME 2.28 and my notebook went to sleep if I plug in or plug out the power plug.
I discovered that on this occasions only the display was logged if I changed the Power Management Preferences (reach it with right click on the battery in the Notification Area).
For both registers “On AC Power” and “On Battery Power” you have to change the action for “If laptop lid is closed” to “Blank screen”.
So I still have to unlock the display but not to wake the hole laptop from “sleep” like “hibernate” (suspend-to-disk)or “suspend” (suspend-to-ram).
The hardware of notebooks/the kernel/GNOME Power Manager seems not always to distinguish between plugging in/out external power supply (or the [temporal] electrical power variation caused by that) and the signal if the lid/ is closed.