MacBook Pro restores last user session after shutdown because of low battery
You might not have understood it fully since your lid was closed.  So I will take you to an adventure to demonstrate what you would have seen if you left the lid open at the time.
Battery Low (~15%)
Around at 15% when running on battery power, the battery icon in the menu bar will turn red in order to notify you that your battery is starting to get low.



Battery Critically Low (~5%)
If you ignore the initial low battery warning and keep on using DC power, the MacBook will warn you about the &quot;reserve battery power&quot; when the battery drops to about 5%.  At this point, you should as soon as possible plug in your laptop into AC power.  Or else, the computer will take its own action soon.



Battery Empty (~0%)
When your battery reaches &quot;empty&quot; (around 0%), the computer is forced into sleep mode in order to prevent its memory contents from being destroyed or lost.




Your MacBook hit the &quot;empty&quot; battery level and had gone to sleep to prevent your data from being damaged.  If it did not sleep, then it would just crash-shutdown and all the unsaved data would be mass-lost.  When you plugged in and powered back on, it restored the previous session.

UPDATE:

My son plugged it in and it restarted. It asked for his password to login on his account but when he validated the credentials, instead of opening his a new session for him it reconnected him to the last active session; my session on my account.
Thanks but that doesn't explain why when logged in as user 1 and it goes on sleep, when you go back and plug it, then at the user login prompt you log with user 2 but it opens user 1 session. Huge security issue to me.
Yes multiple times but not with the latest updates. My question was asked in June.

Really?  That's extremely strange.  I've never seen a Macbook doing this before, and different user sessions shouldn't overlap each other.  If this is still happening, then I would like to suggest you to report this to the Apple company.  It seems like you are experiencing a huge security-related issue, so please call the Apple company about this immediately. It appears like your Mac could not tell the difference between his account and yours.  This is a massive problem, so please report this to Apple ASAP!

As more of a Windows user, I will also point out that in Microsoft Windows it functions in a similar method but what displays on the screen is slightly different. On Windows XP, for example, this is how it works:
Battery Low (~20%): At first, the battery indicator in the taskbar becomes less filled - barely filled with its blue juice.



Battery Critically Low (10%): When the battery reaches 10%, the indicator gets a red X mark and a notification is triggered, and the system urges the user to either replace the battery or connect to AC power immediately.



Battery Empty (3%): On XP, when the battery reaches 3% the computer will hibernate.



But as far as I know, neither Windows nor Mac should perform the action you are describing.