Switching sexes is a classic supervillain ploy. In the Superman comics of the 1940s, the Ultra-Humanite transferred his mind into the body of a woman.
On top of all that, this was just a really good episode. There was one point where the Doctor remarks that there was something very obvious that he was missing. We're then shown the obvious. It was a head-slapper moment, because I'd been staring right at it, too, and never spotted it.
In Night of the Doctor last year, the Sisterhood of Karn offered the Eight Doctor a series of potions, one choice was man or woman. So, yes it is possible. He chose Warrior by the way, and regenerated into John Hurt’s War Doctor.