I am exclusively gay and that has led to the puzzle of how this ruthless mechanism wouldn't have weeded that out.
Even though gay people can have children natural selection should work so long as on average they have less children than straights. One explanation is that being gay is not due to genes, not heritable, so then natural selection won't have any effect. Perhaps it is a trait that appears randomly in each generation.
Natural selection happens when there is differential reproductive success over multiple generations. Those that have more offspring are favoured and those with less are disfavoured. It's not necessarily the fastest or the strongest that succeed. Over 1 generation chance can play a big factor but over multiple generations it tends to even out.
All of that is quite true. It's somewhat like how sickle cell trait provides some immunity to malaria. In that case sickle cell trait is a harmful mutation affecting red blood cells and malaria resistance is a side effect. In malaria prone areas at low allele frequencies the beneficial side effect is stronger than the harmful ones, but by the time it reaches 20% the harmful effects dominate. (If it's not a malaria prone area the trait provides no benefit.)
And if homosexuality is not heritable then natural selection won't work at all. AFAIK it's not heritable so no natural selection.