Do you believe in the Bro Code? Or the Girl Code? Not going after your friend's ex, not going after the same person your friend likes, not making any advances or suggestive behaviors on your friend's partner, etc?
I do because I believe it's a matter of respect and loyalty. Respect and loyalty enough for your friend that you don't slide into hooking up with someone they once loved.