Unpredictable things like the situation you are describing is generally caused by a game crash or terminating the game without shutting it down first (like turning off the computer, etc).
Essentially, anything that interferes with the game saving its state to the savegame file can cause this sort of reaction.
There is no way to change your boy back into a girl - but prevention can be quitting the game properly, and backing up your savegame files in case it crashes (see the link below for directions).
http://www.ldw.com/faq.php?game=10&platform=9&f=82&q=908#answer