The win took Warriors 12 points clear of bottom club Bristol, who will be relegated back to the Championship if they lose to leaders Wasps on Sunday.
Bath led 10-6 at half-time, helped by winger Matt Banahan's try.
But Josh Adams and Wynand Olivier both crossed for the hosts and ex-Bath lock Will Spencer completed victory.
George Ford kicked a late penalty to earn fifth-placed Bath a losing bonus point, but with two games left to play they are four points behind Leicester, who hammered Newcastle at Welford Road.
Warriors were good value for their fifth home league win of the season, with their excellent record at Sixways likely to be enough to keep them in the top flight.
Bath had appeared set for their first Premiership away win since 30 October when, against the run of play, Jonathan Joseph fed Banahan for the only try of the first period.
However, two penalties from Ryan Mills - the second a huge kick from well inside his own half - kept the hosts in touch at the halfway point.
England's Ben Te'o and fellow centre Jackson Willison superbly created Adams' try and replacement Olivier put Worcester in front for the first time, before Spencer rounded off a long spell of Worcester pressure by touching down against his old club.
Worcester director of rugby Gary Gold: "Bristol have got two home games out of three left, so under no circumstances am I going to sit here and say we are safe. They beat Bath at home and ran Exeter close at Sandy Park.
"If we are able to get through this fight, then I will definitely look to chat to the club to see what the plans are for next season.
"I am elated and very proud of the guys. They stuck in for the full 80 minutes against a quality Bath team."
Bath director of rugby Todd Blackadder: "It is so disappointing. We are up and down, up and down.
"Our (defensive) exits were really poor. We just gifted the ball back to Worcester, who played really well, and in the second half, unforced errors killed us.
"We knew what was at stake today, which makes it even more disappointing, but we are not going to give up hope. There is still too much to play for and a lot can happen."
Worcester: Pennell; Humphreys, Willison, Te'o, Adams; Mills, Hougaard; Bower, Taufete'e, Alo, O'Callaghan (capt), Spencer, Vui, Lewis, Mama.
Replacements: Singleton, Grant, Milasinovich, Potgieter, Fa'osiliva, Baldwin, Lamb, Olivier.
Bath: Watson; Rokoduguni, Joseph, Tapuai, Banahan; Ford (co-capt), Fotuali'i; Catt, Batty, Palma-Newport, Ewels, Stooke, Ellis, Louw (co-capt), Faletau.
Replacements: Charles, Obano, Knight, Denton, Z Mercer, Cook, Priestland, T Homer.
For the latest rugby union news follow @bbcrugbyunion on Twitter.
Worcester Warriors defeated Bath at Sixways to almost guarantee their Premiership survival and dent the visitors' hopes of a top-four finish.