A known-to-be heterosexual male who has just performed an action one would consider to be homoerotic in nature, usually for the sake of comedy. So, in the moments following said action, it is perfectly ok to call this person a "fag".
It is not ok to use the word "fag" in reference to an actual homosexual, as it is not only quite rude but also an incorrect use of the word.
Bob, Dave and some friends are hanging out.
Bob grabs Dave's butt.
Dave: "Awe, you fag!"
Bob and friends laugh.
Bob sees Elton John kiss a man on tv.
Bob: "Awe man, what a fag!"
Dave: "No dude, Sir Elton is gay."
Bob: "Oh. My bad."