EXCLUSIVE

Former Queens of the Stone Age bassist Nick Oliveri just dodged a major bullet after his 4-hour standoff with a S.W.A.T. team last year -- cutting a MAJOR deal with prosecutors that will keep him out of jail.

Oliveri's lawyer Freddy Sayegh tells TMZ, "Mr. Oliveri agreed to plead to one count of possession of cocaine and a dismissal of the remaining SIX felony counts."

If you recall ... Oliveri was arrested last July in L.A. after a fight with his GF resulted in a S.W.A.T. standoff. Cops eventually searched his home, and claim they found a loaded shotgun along with cocaine and methamphetamines.

The musician had faced up to 15 YEARS in the slammer for the combined charges -- but under the deal, he'll only get 3 years felony probation. Oliveri also agreed to 52 weeks of anger management and 200 hours of community service.