Jack Nicholson. Leonardo DiCaprio. Matt Damon. Martin Sheen. Alec Baldwin. Mark Wahlberg. Each name stands on its own as megawatt talent in Hollywood, but what happens when they all come together in one shoot-'em-up, testosterone-filled film? That question is answered in director Martin Scorsese's thriller, The Departed .

“It is a story of trust and betrayal and deception and loyalty,” says Scorsese, whose description of The Departed reads as complex and intriguing as the story itself. Set in South Boston, the film tells the tale of the hot-tempered and troubled Billy Costigan (DiCaprio) and the seemingly upstanding golden boy, Colin Sullivan (Damon).

“I read the script and it was this tightly woven, highly complex ensemble piece, this gangster thriller,” says DiCaprio. “It's very rare in this business where a script lands on your lap that is ready to go. This was one of those rare occurrences.”

Screenwriter William Monahan, an Irish-American from Boston, placed the characters in his hometown. The film begins as Costigan is hired by state police to crack the city's organized crime ring led by the notorious Frank Costello (Nicholson). To do so, street-tough Costigan manages to convince Costello to make him part of his criminal team.

Meanwhile, Sullivan is hired by the Boston police force to take down Costello; however, he's actually working for Costello to protect the ring by reporting the police force's every move. Can anyone say double, double agents?

To research their roles, DiCaprio and Damon worked with Massachusetts state police officer Thomas Duffy, who was hired to connect the actors to actual people and circumstances that helped them understand the precarious and anxiety-ridden lives of undercover cops.

“Part of the process for me was going to Boston, learning about the subculture, meeting some of the real people that were around during the '80s, during the Whitey era,” says DiCaprio, referring to one of South Boston's most notorious mob kingpins, Whitey Bulger.

“But I really wanted to meet some guys from Southie. It was just important to meet some of the real characters, get to know them and hear personal accounts from them. To be able to penetrate some of these guys' minds and really get deep into what they were thinking.”

Damon, on the other hand, shared a special experience with state police during a ride-along that soon turned into a major drug bust on the streets of Boston. “I'm sure I was in no real danger; they brought twice as many cops as they normally do in those raids. I was in the back of the line with my bulletproof vest on, standing there thinking, ‘What am I doing here?'” he says with a laugh. “But anytime you get access like that, it's really the most interesting part of this job of acting.”

Nicholson took it up a notch by playing Costello, the crazed, arrogant and sexually deviant crime boss, creating a personality that was trademark Nicholson. Both DiCaprio and Damon knew to expect the unexpected with Scorsese encouraging Nicholson to improvise some of the most memorable scenes in the film.

“For me, there were a number of different scenes where I had no idea what was going to happen,” admits DiCaprio. “One scene in particular, I remember Jack speaking to Marty saying he didn't feel like he was being intimidating enough. The next day the prop guy tells me, ‘Be careful! [Jack's] got a fire extinguisher, a gun, some matches and a bottle of whiskey,'” he recalls with a smile. “It was the table scene. That was one of the most memorable experiences of my life, as far as being an actor is concerned.”

Though the “table scene” was memorable, the most shocking would undoubtedly be the movie theater scene with Nicholson and Damon – a scene that may go down as Nicholson's most sexually revealing and perverted to date.

“Jack really brought this really incredible new element, a new layer to that character,” Damon says of the scene that was concocted by Nicholson and improvised on the set. “He made [Costello] more obscene in a way that felt authentic because these [gangsters] would sublimate sex into violence and violence into sex. I found him really committed to making the thing believable and pushing the envelope as much as he could.”

Addressing a few of the ingredients of any good film – the story, the language, the characters – Scorsese shares his main reason to see The Departed , beyond just the memorable scenes. “Of all these extraordinary elements,” he reveals, “the one I tend to rely on most often to tell the story is the cast. To have the actors we had in this film all together was remarkable.”

The Departed releases in theaters Oct. 6