Brandon Davis Key Person in Spelling Mansion Sale

6/17/2011 5:30 AM PDT

Brandon Davis -- Key Person In Candy Spelling Mansion Sale

One of the biggest real estate deals in the history of Los Angeles was hatched by none other than ... BRANDON DAVIS!!!  And get this ... He'll get hundreds of thousands of bucks for his efforts.

Yes, TMZ has learned Greasy Bear -- the ne'er-do-well grandson of the late oil mogul Marvin Davis -- was instrumental in the sale of Candy Spelling's mansion.

Here's the way it went down.  Brandon was at a Hollywood nightclub on April 27, partying with Petra Ecclestone -- the 22-year-old daughter of billionaire Formula One mogul Bernie Ecclestone -- when she told him she wanted to buy a HUGE house in L.A.

Brandon sprung into action, hooking Petra up with realtor/Paris Hilton's father, Rick Hilton.  Sources tell TMZ, Rick made a deal with Brandon -- to give him a $250,000 finder's fee if Rick could sell a mansion to Petra. So Rick then showed Petra Fleur de Lys -- a huge mansion in Holmby Hills.  She offered $85 million.  But then the seller started making demands, saying she wanted to keep this statue and that statue.  Petra was fine with it, until the seller demanded an additional $700,000 to cover her moving costs.

Petra said sayonara to Fleur de Lys and Rick took her to Candy Spelling's 57,000 square foot mansion in Holmby Hills ... near the Playboy mansion.  Sources connected to the sale tell TMZ ... the deal was sealed at $85 million -- ALL CASH.  And get this -- Rick not only represents Petra, he also represents Candy, so he scored one of the biggest commissions for a realtor ever.

But there's still this little issue of paying Brandon the $250k.  We've learned escrow on Candy's mansion will close in 2 weeks, but Brandon -- who became really famous because of his "FIRECROTCH RANT" targeting Lindsay Lohan -- can hardly wait.  You see, the night he talked to Petra about buying a huge mansion, he got in a fight outside the nightclub and was arrested and charged with cocaine possession.

The guy who got into the fight with Brandon is threatening to sue him, and Brandon needs the $250k to settle the dispute.

We love happy endings.