The embarrassing answer is that for hundreds of millions of years the world was gay. This was a terrible time for evolution, and the fossil record is quite pornographic. Not only that, but reproduction was very difficult. It's believed that the dinosaurs died out as a result. Then a miracle happened, and females appeared. The rest is history.
[Source: Secret archives of Darwin Central.]
"Why are there two sexes? Did they evolve simultaneously?"
'Claus Wilke of Caltech and Chris Adami, of both Caltech and JPL, have concluded that asexual bacteria can be nudged to evolve into sexual reproduction if they are subject to high levels of mutation induced by environmental stressfrom, say, radiation exposure or a catastrophic meteor.'
http://66.102.7.104/search?q=cache:KvxxoPGDG1EJ:news.nationalgeographic.com/news/2001/07/0709_sexorigin.html+origins+of+sexual+reproduction&hl=en
You got it BACKWARDS!!
Then a miracle happened, and females appeared.