I believe the Visuddhimagga is the first text to suggest the same-sex rule, but it only applies when you're doing the specific self>friend>indifferent>enemy path. If you're sending metta to the entire world, or to sizes or types of beings, it's totally appropriate to send it towards the opposite sex. It's just important to keep your metta during the "friend" and "indifferent" stage (and "enemy" I guess) to someone you aren't sexually attracted to.
Gain and loss, status and disgrace,
censure and praise, pleasure and pain:
these conditions among human beings are inconstant,
impermanent, subject to change.
Knowing this, the wise person, mindful,
ponders these changing conditions.
Desirable things don’t charm the mind,
undesirable ones bring no resistance.
His welcoming and rebelling are scattered,
gone to their end,
do not exist.
- Lokavipatti Sutta