Already with the first sentence of “Sleeping With Strangers,” Thomson establishes himself as an independent mind, positing a definition of moviegoing that complicates the by-now tired idea of film as an inherently voyeuristic genre: “The movie screen is a window, and the trick of the medium is to let us feel we can pass through it.” We first watch, in other words, and then we connect so intensely that the frame falls away and we are part of the picture instead of outside it. It is an expansive definition, one that upends the whole notion of film as predominantly catering to the infamous “male gaze” beloved of feminist film critics (although Thomson later on dutifully devotes an entire chapter to this very trope), suggesting instead that its intention and its reach are larger and more inclusive.

If there is a consistent theme to this book, it is that the erotic life of movies shapes and misshapes us, codifying our fantasies, shooting an arrow into them and occasionally showing them up as bogus. Beginning with his early infatuation with “Bonnie and Clyde,” which Thomson tells us he saw “five times in a week in 1967,” he vaguely intuits, together with a fellow enthusiast, “how cinema turned on a level of desire that could never quite be fulfilled. We gazed at the screen with longing, but we could never get there.” From here he goes on to explore the subtext of eros — of desire in general but also the specifics of homosexual desire — that plays out under the putatively heteronormative universe of the silver screen. To this end he is single-minded, even fanatic, about ferreting out closeted gayness in both straight-seeming actors (Burt Lancaster, Katharine Hepburn) and characters (Clyde Barrow in “Bonnie and Clyde,” Johnnie Aysgarth in “Suspicion”), as well as straight-seeming narratives (“Sweet Smell of Success,” “Gilda”) — so much so that at some points he reminded me of the gay writer Paul Monette, whom I used to sun with at the Beverly Hills Hotel when I was editing his memoir “Borrowed Time” and who used to insist that every actor — or, indeed, man — I could think of was gay, including Henry Kissinger. Thomson also spends a lot of time (too much for my liking) on the enigma of Cary Grant’s sexual orientation, although this is hardly news. Before the recent documentary about and memoir by Scotty Bowers (also known as “pimp to the stars”), there was a 1989 biography of Grant, written by Charles Higham and Roy Moseley, that proceeded from the premise that the charismatic leading man was at the very least bisexual.

Despite this focus, Thomson’s thesis, by his own admission, goes farther than merely compiling “a list of gay careers” or “outing” people: “Rather,” he writes, “I want to extend the proposal that the atmosphere of all movies had a gay air.” He is referring specifically to films of the 1930s made in the wake of the Production Code, but in truth he sprinkles hints throughout the book that he considers the medium of cinema conducive to the subversion of smug heterosexual pieties. Referring to the director George Cukor and other gay film people “who prospered naturally for decades in Hollywood,” Thomson observes: “They intuited that the medium was detached or ironic about life’s conventional ideals and heavenly marriages. The medium understood transience and promiscuity — the alleged liberties that straights sometimes envied in gay life.”

In the end, though, “Sleeping With Strangers” is larger than any of its hypotheses about “the unease of straight manhood,” or its obvious points (“Porn is full of male hatred of women”) — or, again, its sweeping statements, replete with slightly smarmy wordplay, such as: “Many womanizers leave women dissatisfied. They tend to come in their own minds.” Thomson is set on linking our frenetic carnality on screen to our vexed carnality in real life, and in doing so he elucidates the cultural impact of film on the shadowy areas of our collective psyche — whether it be gender, racial politics or the male pursuit of power — with an unflinching, sardonic eye. He invokes everyone from Tarzan to Trump and everything from “Last Tango in Paris” to #MeToo. If it is true that he sometimes substitutes free association for deep thinking and throws out aperçus just to see if they’ll stick, it is also true that “Sleeping With Strangers” is dazzling in the effrontery of its opinions, even when they don’t quite hold up. Thomson, a stylist extraordinaire, has written an unaccountable and irresistible book. He reminds us that in a world of increasing sham, movies have the virtue of being instructive, occasionally enlightening shams — to embrace or ignore, as the case may be, but always full of bright dreams, dark visions and glittering possibilities.