Amid all the debris of "The Hangover," and it is considerable -- the tooth, the Taser, the tiger, the puke, the police, the stripper, the shots and so very much more -- there is a sort of perverse brilliance or brilliant perverseness to be found in this story of a bachelor party gone terribly wrong.

The basic conceit is nothing new: Guys go to Vegas to give groom one last night of debauched fun. But in "The Hangover," director Todd Phillips and the screenwriting team of Jon Lucas and Scott Moore have created a heart-of-darkness comedy running naked and wild through the streets. Hysterically and embarrassingly black, "The Hangover" nevertheless is filled with moments as softhearted as they are crude, as forgiving as unforgivable. And it all begins when they lose Doug.

Doug is the groom played by Justin Bartha. He and BFFs Phil (Bradley Cooper) and Stu (Ed Helms) and brother-in-law-to-be Alan (Zach Galifianakis) make up this wolf pack, as the slightly cracked Alan puts it during a rooftop toast over shots of Jägermeister. At one point, Phil nods in Alan's direction and asks Doug, "Should we be worried about him?" The correct answer would be "Yes," if for no other reason than Galifianakis steals the show.

There is far more than 300 miles of desert separating the two worlds of "The Hangover."The sumptuous perfection of wedding cakes, lush flowers and an even more luscious bride back in L.A. is the one the pack is running from. The neon glitz of the Las Vegas Strip with its "we won't tell" promise is the dream they're heading toward, that and a $4,000-a-night suite in Caesars Palace where Alan can wear a man purse while chanting "Who Let The Dogs Out" and seem almost normal.

Doug, the straight arrow in a designer suit with the rich fiancée on his arm, is the one who drew the success card years ago. Since he's lost for much of the film, we really don't get to know him; just as well since he's basically just a nice guy in a bad spot.

Stu, a dentist, is the nerd of the group and hasn't colored outside the lines since the first grade. That he's got a controlling girlfriend is no surprise, though Rachael Harris' Melissa creates a whole new level of acerbic, as in scar-you-for-life acerbic. She's just one of the women that this movie doesn't like. In fact, except for Heather Graham's stripper, Jade, and I would remind you she is a stripper, you get the feeling the filmmakers don't like women at all. That might be more of an issue if they were anything more than window dressing, particularly the bride, Tracy (Sasha Barrese), whose main job is to look great while doing her nails and occasionally frown and pout during phone calls. I think "Where is Doug?" and "Where the hell is Doug?" might be her only lines of dialogue.

Phil, a married schoolteacher with a kid, is the cool guy conflicted by how conventional his life has become. He's supposed to be the leader of the pack, Mr. Confident, we're adults, we can figure this out. His arrogance is hard to take at times, but he does get things going after the guys wake up to a morning-after of what utter mayhem must look like. Their luxury suite is awash with bodily fluids and floating blow-up dolls; clothing, food and empty bottles are strewn everywhere; there's an unidentified baby in a closet, an unidentified tiger in the bathroom and blinding headaches you can almost feel. What there isn't, yet, is any shred of regret.

Like the chicken that is picking its way through this mess, Phil starts trying to get the guys to help reconstruct the night they can't remember.

If you're a gambler, and we're in Vegas after all, the friend to bet on is Galifianakis' Alan, the most complex and strangely likable one of the bunch. Socially awkward, completely inappropriate, genuinely innocent and prescient at the same time, he's like having an R-rated kid on your hands.

When you tire of Stu whining over his missing tooth, or the endless invective of a small, naked, gay Chinese high-rolling mobster named Mr. Chow (Ken Jeong) representing every possible cliché and racial slur rolled into one angry body, Alan is there doing the hard emotional work of "The Hangover." While his scenes with the baby are priceless (and sometimes tasteless), Alan turns out to be the one with the emotional depth.

Piece by sordid piece, the night starts coming back to them: the hospital, the police station, the wedding chapel, and, in keeping with its theme of overindulgence, much more. Some bits are better than others, but one of the best comes when former heavyweight champ Mike Tyson enters the picture, his right hook still deadly and his version of Phil Collins' "In the Air Tonight" already a YouTube classic.

Another saving grace is the soundtrack. The music provides its own narrative score, whether an oldie such as "It's Now or Never" that has that born-in-Vegas feel, or Kanye West's "Can't Tell Me Nothing" that plays as Vegas' neon skyline unfolds in front of us.

And of course Alan is in there too, finding his inner absurdity and delivering yet another deft touch that lifts the film beyond the ordinary. His best musical moment comes in the back seat of the classic Mercedes convertible his father (Jeffrey Tambor) lent them for the trip. Bruised and nearly broken, both the car and the boys, they are heading toward what they hope will finally be Doug.

It's a simple sing-song that goes something like this, "We're the three best friends that anyone could have, we're the three best friends that anyone could have . . . " Which is also what passes for the moral of this story -- in spite of everything that does happen in Vegas, you could do worse than having friends like these.

betsy.sharkey@latimes.com