I accidentally entered a women's restroom at an airport once. It was only to get a paper towel, not to use the facilities, but even so it was a shock when I realized I was in the wrong place. I got out again as quickly as I could.
If you’re really, really tired, it takes longer to notice.