An option I didn't see noted:
Our queer emperor doesn't want, by any means, to produce an heir. There's pressure, sure. Everyone's begging him to. But no, he is not going to succumb to such petty and unnecessary things. He's better than that and he's got a better idea in mind.
So our emperor uses foul magic to transform himself into [choose your favorite immortal intelligent undead]. Boom, no heir needed. Plus, you get the stability of a single emperor forever (provided our emperor can stand up to the wars and such which will undoubtedly occur in the aftermath - but he gets to maintain his position and not compromise his sexuality). Perhaps cast Gentle Repose on his own corpse daily and people might not even catch on for a few decades, enough time that he could establish enough credibility with the nobility and the peasantry that they like having him as emperor and don't feel much desire for a new one.
Of course, going this route might well indulge in far greater evil than that which the bloodline is preventing from befalling the kingdom. Such is the price of hubris, after all.
And then the mists take him and his kingdom plunges into great turmoil while he's tormented in Ravenloft as a dark lord.