Queens of the Stone Age frontman Josh Homme's allegedly threatened to kill his ex-wife's new boyfriend ... and now the guy just got court-ordered protection.
According to new legal docs obtained by TMZ ... Josh allegedly started making death threats after Gunner Foxx started seeing Josh's ex-wife, Brody Dalle, back in 2020 ... and Foxx says things finally came to a head this past Christmas Eve.
Gunner claims he was doing some Christmas shopping at a mall in Thousand Oaks, CA when Josh approached him and threatened to throw him off a balcony.
In the docs, Gunner claims Josh first got in his face inside an Apple Store, telling him ... "I'm going to kill you, you f****** p****" ... and seemingly challenging him to a fight.
Foxx claims Josh approached him again outside the Apple Store, viciously berating him and threatening to kill him, and toss him over the second-floor balcony. He says at one point Josh actually grabbed his arm and tried to throw him over the railing.
In the docs, he claims Josh dug his fingernails into his hand during the altercation, and he truly believed Josh was going to throw him to his death.
Gunner claims he called law enforcement and cops responded, but not before Josh got the hell outta there -- still, he went ahead and filed a police report.
In the docs, Gunner says he lives with Josh's ex and their children in Malibu ... and thinks Josh broke into the home and even slashed his tires.
Foxx beelined it to court and a judge granted him a temporary restraining order requiring Josh to stay at least 50 yards away from Gunner and Gunner's 2 daughters.
We reached out to Homme's camp ... so far, no word back.