Russell M. Nelson said in his spring 2002 General Conference address, How Firm Our Foundation:
"Gender disorientation is poorly understood."
When discussing the topic of gender and sexual orientation, I focus on one thing first - the mathematics. We all know, hopefully, that biological sex is not determined at the moment of conception, but rather that it happens through the process of gestation. We have NO IDEA when the spirit enters the body; the prophets have been very clear about that. Therefore, even if spirits are male and female, we have no idea whatsoever when they enter the forming fetus.
So, assuming for a moment that spirits are male and female just to stay solidly within the bounds of current Mormon doctrine, what are the mathematical chances that there end up being the exact same number of male and female spirits as there are male and female mortal bodies? Why would it be against our theology in any way to say that there MIGHT be some male spirits in female bodies and female spirits in male bodies? Perhaps they enter the body prior to formal, biological sexual "assignment"; perhaps there simply is an imbalance when all is said and done and some "mixing" must occur for all spirits to be born into mortal bodies; perhaps any number of other explanations exist. My point is that there is no concrete reason of which I can think that every male spirit MUST enter a male mortal body or every female spirit MUST enter a female mortal body.
Actually, if we allow for that simple possibility, much (if not all) of our difficulty in dealing with homosexuality and inter-sex issues would disappear. As I've said elsewhere, taking mortal sexuality out of the eternal equation (leaving gender/sex alone, but removing all things dealing with actual sexual intercourse and its related activities) would open up all kinds of possibilities in the hereafter - and it would remove instantly much of our repulsion toward and problems with polygamy, as well.
I'm NOT saying this is the "right" outlook or "true". I have no clue, really, if there will be a "sexual" component to the afterlife. I personally doubt it, and there is nothing in our canon that insists there will be, but I don't know. What I'm saying is that much if not all of our angst and confusion and difficulty would vanish if we held to "gender/sex" as an eternal characteristic but let go of "sexual activity" as an eternal characteristic - and that is totally consistent with a reasonable parsing of "The Family: A Proclamation to the World".
Elder Nelson was 100% right in his 2002 talk: This is one area where there is little concrete understanding - a MUCH more complicated topic than most people realize and accept. Therefore, I am open to lots of possibilities that would help us reconcile these things without having to lose the core framework of our theology - and I believe there are multiple ways to do so that fit solidly within the broad spectrum of Mormonism, even if we still can't reach certainty in our conclusions.