Brandi Glanville can win a reprieve from the producers of "The Real Housewives of Beverly Hills" if she plays nice as an occasional guest ... TMZ has learned.

As we reported, Brandi got the ax Thursday after producers decided she was just too much trouble. Brandi was difficult and erratic on the set, fighting -- sometimes physically -- with other castmates.

But sources connected with the show tell us, they are not going to immediately replace her. They're hoping Brandi views this as a "Come to Jesus," and if she comes back for occasional visits, she can prove to them she can act appropriately enough so she doesn't get in the way of production.

It mirrors what happened to Porsha Williams on "The Real Housewives of Atlanta." Porsha got demoted because of bad behavior, made occasional appearances afterward and rehabilitated herself enough to come back as a cast member.