I didn't know they could evolve during the night. I've been leaving my tamagotchis unpaused overnight for years and that's never happened to me, and I've been using versions 1-5. Maybe it's a glitch.
A tamagotchi can evolve during the night. you can find your tamagotchi's bedtime on google and that way you know when it will sleep. For eg. my tamagotchi evolved at 2 am. after that i took care of it and it went to sleep about 30 mins later.
My music star woke me up at about four o'clock once, beeping. My little hitodetchi was wide awake, and nothing was wrong. I checked the time on the tama with my phone, and they were both at four. Then the screen started to flash and it transformed into a teen. It stayed awake for about a minute, then went back to sleep again. A similar thing also happened to my sister's music star.
The music star is the only version to have done this to me (I have all European versions from 2-6). Hope this helps.