This is a great question. For starter's and perspective, I'm a gay man.
I think I speak for most gays and lesbians when I say that it is very hard to know who it's OK to hit on. As gays and lesbians, we also have to be extremely careful so as not to upset someone if we express interest. Lots of people believe in "gaydar," but some gays and lesbians are better at this skill than others. To make things more difficult (at least for gay men), straight men now are becoming more and more metrosexual in their appearance and mannerisms. It's been my experience (after being "out" for almost 15 years) that it is now almost impossible to know who might be gay or straight. Especially in 2012, you can't assume a deep-voiced, muscular, bearded, country-ranch cowboy is straight, and you can't assume that a nicely dressed, light voice, musically gifted dancer living in San Francisco is gay.
With all that in mind, here are some experiences I've had:
When a girl hits on me, I am extremely flattered. I never get upset or offended. I end up telling her that I'm gay, but that I'm really flattered and still don't mind flirting. On the other hand, my experience of showing interest in another guy has been mixed. I've had several co-workers who I was convinced were straight, but I still liked them and over time they end up confessing that they are gay. One such guy was someone I ended up dating for a while.
On the opposite end of the spectrum, I sent a very cautious email to a co-worker telling him that I'm gay and thought he was cute, but didn't want to offend or upset him in any way. The response that I got was something like "go f*** yourself you sick f*g."
So, it fascinates me that when straight people hit on gay people, usually the gay person responds with flattery and grace. When a gay person hits on a straight person, the response tends to be shock, disgust, or outrage. This isn't always true. For example, I've had some straight guys that I've hit on that have reacted the same way that I react to a straight girl when she hits on me. They're flattered, and sometimes like to "play" flirt just for fun. Those guys are the ones that are most comfortable with their own sexuality ... but men who are comfortable with their own sexuality seems to be quite rare.
More questions on dating and relationships: