It's McShep, established relationship. John (I think....) is made het by an ancient device they encounter off world. He took part in a ceremony of some sort to relieve him off his burdens (or something). When returning to Atlantis he starts noticing boobs, both on Teyla and Elizabeth. They realise the device has changed his sexuality and he goes through a rocky patch both with Rodney, but also with himself. He has a few moments of doubt whether he wants to change back. At least I believe Rodney accuses him of having doubts. They return to the planet to discover the priests refuse to help, but in the end John uses his connection to ancient tech and manages to reverse how the whole device works.
Does it ring any bells? Thank you on advance :)