This happened to me recently while playing as a Slavic pagan (post-Charlemagne). Except my heterosexual ruler had not one, but TWO secret gay lovers, one of whom was his heir and member of his dynasty. At first I thought it was just a localization error, so when you moused over the character's portrait instead of saying "your cousin" or whatever it said "your lover," but no. Both dudes appeared in the "Relationships" tab of my ruler's character screen under the "Lovers" section.
Here's the cause.
When pagans hold the festival specific to their religion (the one you can pick from the Intrigue tab), if you have two homosexual vassals, then you will get an event where your ruler stumbles outside to take a piss and catches your two vassals "kissing passionately." Your ruler is aghast and receives a -15 relations penalty with the two vassals. The event is supposed to set those two vassals as lovers of one another, but due to an error in the coding, it makes both of them a lover of YOUR RULER. So I guess the part of the event that isn't described is that your drunken ruler says "Count me in!" and jumps in, making it a menage-a-trois, and the -15 relations penalty is your vassals being jealous of you for stealing the other vassal's affection from them.