Midnight Cowboy moseys into UK cinemas again next month on the occasion of its 50th anniversary, and with it comes another opportunity to ask whether this is a film about homophobia or a homophobic film. At the risk of sounding perverse, I really don’t mind. My feelings toward the film were formed by seeing it in my early teens, when I already knew I was gay and hankered after images of other gay men on screen without caring whether they were problematic or toxic – words, incidentally, that would never have been used in that context when I first saw it in the mid-1980s.

In its portrayal of the friendship between two New York City street hustlers – the budding gigolo Joe Buck (Jon Voight), tall and sweet as an ice-cream sundae, and the stunted, snivelling chancer “Ratso” Rizzo (Dustin Hoffman) – the picture hints at the inexpressible desires in any bromance. Ratso bandies the word “faggot” around and mocks Joe for the campness of his cowboy duds. Evidently the homophobe doth protest too much, for we have been privy to Ratso’s fantasies in which Joe runs shirtless with him along the beach.

Christopher Reeve, left, and Michael Caine in Deathtrap. Photograph: Louis Goldman/Warner Bros/Kobal/REX/Shutterstock

It is the penultimate scene, when Joe robs, beats and perhaps even kills a gay client, that throws the movie into disarray. The scene itself provides a snapshot of Joe’s own shame and self-doubt, and a film should be allowed to depict the consequences of homophobia without being accused of perpetuating it. But it’s the way the attack on that man is swept blithely aside in the next scene that casts doubts on the motives of the film, and on the integrity of its gay British director, John Schlesinger. So why is it that I struggle to take offence?

What we look for in our formative years can be very different from the demands we make later as analytical adults, and it was certainly more important to me that representations of gayness were complex or colourful than that they were positive, whatever that meant. As far as I was concerned, film-makers were welcome to be hostile or mocking toward homosexuality just so long as they didn’t ignore it. I would have taken animosity over anonymity any day.

Michael Robbins, left, and Peter Sellers in The Pink Panther Strikes Again. Photograph: United Artists/Kobal/REX/Shutterstock

What heterosexual audiences may need longer to appreciate, having grown up surrounded by reflections of their own kind on every screen and billboard, is that gay audiences will take whatever image they can get and then drain it for meaning and nourishment. Like our counterparts in other underrepresented minorities, we learn to be fastidious noticers and collectors, seizing on any old leftover and rustling up a banquet for one. That explains my affection for films that wouldn’t pass the gay equivalent of the Bechdel test.

As a child, I wanted to visit the secret nightclub in The Pink Panther Strikes Again where everyone is limp-wristed and light in the loafers. When Peter Sellers as Inspector Clouseau dances with another man, you aren’t meant to find it romantic – just daft. And while the club is a grotesque caricature (well, this is a Pink Panther film and not Ken Loach), the joke is manifestly on Clouseau, in his stiffness and discomfort: everyone but him is having a blast.

Similarly, no one in the James Bond film Diamonds Are Forever is having quite as much fun as Mr Wint (Bruce Glover) and Mr Kidd (Putter Smith), the skipping, hand-holding assassins who never forget their manners even in the middle of a murder. I didn’t mind them being psychos. Better psychos than nothing.

Colin (Paul Freeman) may be sliced up at the start of The Long Good Friday while cruising at a swimming pool, but I loved seeing the whole plot set in motion by a gay man’s desires, even if they do prove fatal. I didn’t even mind it when the mob boss Harold (Bob Hoskins), Colin’s childhood friend, says: “You know how bitchy queers get when their looks start to go.” Disparaging words can be argued with and contested. Silence can’t.

There were nuanced representations of gayness when I wanted them (Dog Day Afternoon, My Beautiful Laundrette, The Naked Civil Servant) but it was a different kind of detective work winkling out the gay bits in otherwise straight films. The flasher in High Anxiety, say, who exposes himself to Mel Brooks in an airport toilet, then squeals when Brooks flees in horror. “Don’t be so gauche,” he calls after him. “We’re all doing it!” Or the flamboyant theatre director Roger DeBris (Christopher Hewett) in Brooks’s The Producers. Max (Zero Mostel) and Leo (Gene Wilder) call in on him at his apartment. “He’s wearing a dress,” hisses Leo under his breath. “No kidding,” says Max.

In A Taste of Honey, Geoffrey (Murray Melvin) has been thrown out by his landlady for canoodling with a fella, while in Thunderbolt and Lightfoot, Clint Eastwood and Jeff Bridges are sweethearts in all but the letter of the script; you just have to spot the signs. There’s a mohawk-sporting biker in Mad Max 2 whose twink boyfriend is killed by a metal boomerang. And Michael Caine even kisses Christopher Reeve (Superman!) in the 1982 film Deathtrap: the first time I had seen one man’s lips on another’s.

That film was directed by Sidney Lumet, who made Dog Day Afternoon. Gay was very big that year, what with Personal Best (sporty lesbians) and Making Love (a married man having a gay affair). It was the Deathtrap smacker, though, that was all over the news. Was the film sensationalist, even homophobic? Undoubtedly. But at least, in the words of the theme song from Midnight Cowboy, it got everybody talkin’. It was down to me to try to make sense of what was being said.

• Ryan Gilbey is a film critic for the New Statesman and writes on film for the Guardian, Sunday Times and Sight & Sound