Okay, this would have been tough for me to say early on. Growing up, I have had long standing feelings of being attracted to women sexually and emotionally. These feelings have been quite strong and overwhelming even. There was always a little nervousness that I wouldn't be able to perform when the time came though. Then, when I did hook up with a girl..... I actually did have some "performance" issues, like I'd just kinda lose steam so to speak. I enjoyed the whole thing a lot though, and I really liked the experience. I just had a hard time getting things working. I was nervous though, and that may have contributed. The nervousness of it might've been why that was the case. I can jerk thinking about sex with women, and I do. However, in the moment, I had trouble but I was quite nervous as it was my first time and it was a one night stand with a girl I didn't even know.
I tend to agree with ShaiHulud. Sexual "underperformance" is fairly common and has nothing to do with your sexual orientation.
This isn't "pure gayness." A person who is purely gay wouldn't masturbate to thoughts of women. You probably just had anxiety, or you didn't find the other person attractive enough, or you just psyched yourself out. It'll become more natural with time.