Second-generation superstar and Hollywood legend Michael Douglas will be in Brookline this week to accept the Coolidge Corner Theatre Foundation’s annual Coolidge Award, honoring original and outstanding contributions to cinema. (Previous recipients include Meryl Streep, Jonathan Demme and Werner Herzog.)

Over the coming weeks the venue will be presenting some of this prolific actor-producer’s greatest hits, including “Fatal Attraction,” “Basic Instinct” and “Wall Street.” But when Douglas takes the stage on Thursday afternoon he’ll be hosting a special screening of his most beloved box office bomb.

Director Curtis Hanson’s sublime, shambolic “Wonder Boys” was released in February of 2000 to mass audience indifference, a victim of lousy timing and a spectacularly ill-conceived marketing campaign. (“I looked somewhere close to Alfred E. Neuman in drag,” Douglas later said of the off-putting original poster.) So highly regarded was the film among critics and in the studio’s front office that Paramount took the costly and fairly unprecedented step of re-releasing it that November with an overhauled promotional campaign, to little avail.

Yet it’s somehow fitting that “Wonder Boys” managed to flop twice, as the movie is practically a valentine to failure — a warmly humane and often side-splittingly funny exploration of underperforming against expectations. This is probably my favorite comedy of the past 20 years.

Douglas stars as pothead professor Grady Tripp, a one-time literary phenomenon who has spent the seven years since his rapturously received debut novel ensconced in academia and stalling for time. His latest wife recently left him, and presumably that has something to do with the fact that Grady’s been having an affair with his unhappily married boss, chancellor of this small, unnamed liberal arts college somewhere in snowy Pennsylvania. Played by a flinty Frances McDormand, she’s just dropped the bomb that she’s pregnant but isn’t sure what to do next, as the perpetually procrastinating (and usually stoned) Professor Tripp doesn’t exactly scream Dad material.

It’s a hectic weekend at the university, with the annual WordFest literary conference in full swing and Grady’s anxious editor (Robert Downey Jr.) flying in from New York, ostensibly for the festivities but actually angling for a sneak peek at his favorite client’s long-delayed sophomore effort. Yeah, about that book — Grady’s currently on page 2,611 with no end in sight, boxes of single-spaced chapters piling in his study like mounting monuments to the author’s increasingly panicky indecision. So naturally when Downey arrives at the airport with a 6-foot-5, tuba-toting transvestite and a suitcase full of drugs, shenanigans begin in earnest.

Tobey Maguire’s James Leer is a student as gifted as he is insufferably pretentious. Still reeling from the news about his impending fatherhood, Grady attempts to take the troubled kid under his wing for the weekend as an unconscious test-drive of this whole parenting thing. To call the results of this experiment disastrous would be a dire understatement.

Tobey Maguire (as James Leer) and Michael Douglas (as Grady Tripp) in "Wonder Boys." (Courtesy Paramount Pictures)

Soon they’re on the run with a dead dog stashed in the trunk of Grady’s rattletrap 1966 Ford Galaxie, alongside a stolen leather jacket worn by Marilyn Monroe at JFK’s inauguration and many, many overdue library books. Situations in “Wonder Boys” tend to snowball from the absurd to the ridiculous with a stoned, screwball logic, our nutty professor accidentally escalating everything with his trademark inertia and the magnificently unhelpful advice, “Let’s try not to think about that right now, James.”

Whittled down from an even wilder and more unwieldy Michael Chabon novel by “The Fabulous Baker Boys” screenwriter Steve Kloves, “Wonder Boys” is one of those movies where everything clicks, brought off at a level of craft practically unheard of for a mainstream studio comedy. The late Curtis Hanson toiled for decades in the trenches as a reliable genre journeyman before 1997’s “L.A. Confidential” made him an overnight sensation at the age of 52. How wonderfully telling that his very next feature was all about a character psychologically paralyzed by the terror of having to follow an acclaimed, popular success.

This is one gorgeously made movie, with Dante Spinotti’s rich, shadowy cinematography eschewing the loud primary colors of contemporary comedies in favor of deep, burnished browns and grays. You feel in your bones these cold Pittsburgh rains, the warm, wooden bookshelves and gentle blankets of snow. Hanson famously coaxed Dede Allen, legendary editor of “Bonnie and Clyde” and “Dog Day Afternoon” out of retirement to cut the picture, which probably explains why the movie feels as if it alights upon its jokes instead of belaboring them. Sight gags like a young police officer forgetting to put the parking brake on his cruiser have an offhanded elegance, as does a priceless throwaway in which Grady yanks on his telephone’s extension cord and a lamp quietly clatters to the floor in a far corner of the frame.

Hanson peppers the soundtrack with lesser-known, late-career tunes from John Lennon, Van Morrison and Leonard Cohen to conjure a husky-voiced, lion-in-winter vibe. But his biggest coup was getting Bob Dylan to pen the original, Oscar-winning theme song, “Things Have Changed.” Reportedly inspired by seeing just 90 minutes of early footage, it’s a sardonic, resigned reflection of the picture’s themes, culminating in the classically Dylan-esque lament: “I’m in love with a woman that don’t even appeal to me.”

It’s easy to forget what a deliciously anarchic screen presence Robert Downey Jr. once was, mischievously swanning through his scenes here with the smirk of a cat who just did something very naughty with the canary. He and Douglas share the intoxicating, easygoing chemistry of two guys who are awfully used to getting into trouble together, even though they’re both beginning to realize this all isn’t nearly as cute as it used to be.

There’s an increasing sense of time running out and old bills coming due throughout the film. (In one of the most tender moments we hear Dylan again, this time singing: “It’s not dark yet/ But it’s getting there.”) Still, we keep rooting for Grady to pull it together, a testament to Douglas’ enormous charisma and the shuffling, avuncular charm with which he imbues this hapless screwup.

The star packed on 35 extra pounds, grew his hair out to a shaggy mess and peers up at the camera through hazy, bloodshot eyes and a pair of glasses that keep slipping further down his nose as the picture wears on. He also spends most of the running time wearing a ratty pink bathrobe for reasons perhaps best left unexplained.

My favorite shot in “Wonder Boys” comes the morning after an all-night rager at Professor Tripp’s house, with a vicious rain pounding down as Spinotti’s camera pauses to regard — with no small amount of melancholy — haphazard piles of empties, overflowing ashtrays and finally one sad, lonely slice of pizza abandoned on the outside porch rail, wilting under a downpour in the early gray light. We’ve all seen this piece of pizza at some point in our lives. Here’s a movie that understands how it got there.

Michael Douglas will be at the Coolidge Corner Theatre’s screening of “Wonder Boys” on Thursday, Nov. 29. The movie is also currently streaming on Amazon Prime.