Northampton's Australian fly-half Shane Drahm, who will join Worcester next season, did his utmost to relegate his prospective employers.
Drahm booted three penalties and converted wing Paul Diggin's first-half try, but Worcester displayed admirable courage and commitment to triumph.
Number eight Drew Hickey's 75th-minute try, converted by substitute Hayes, proved enough, following earlier touchdowns from scrum-half Matt Powell and centre Dale Rasmussen, plus two James Brown conversions.
Had Harlequins not lost against Sale, then Saints would have plunged out of the Premiership just five years after they were crowned European champions.
It was a fraught afternoon for both sides – especially Worcester chairman Cecil Duckworth and his millionaire Northampton counterpart Keith Barwell.
Barwell and his Saints players and fellow officials could only wait for a few agonising minutes after the final whistle before news filtered through from The Stoop of Quins' demise.
But neither Worcester nor Saints will want to go through such torture again next season.
Drahm was confirmed in Northampton's starting line-up just an hour before kick-off, having originally been named on the bench behind veteran England international Paul Grayson.
Drahm will forge Worcester's half-back combination with fellow new recruit Andy Gomarsall next season, but Saints coach Budge Pountney had sufficient confidence in him to kick Warriors out of the Premiership, if required.
Drahm's presence gave a red-hot relegation battle added spice, while Northampton also recalled Scotland prop Tom Smith and New Zealander Andrew Blowers at number eight following their injury problems that had sidelined them since Saints' Heineken Cup quarter-final defeat against Toulouse on April 1.
A capacity 8,500 crowd packed Sixways, and Drahm's first touch saw him rifle a confident 40-metre kick into the Worcester half.
It got better for the Queenslander, as he slotted two penalties during the first eight minutes and made a slashing break that almost produced a try, before opposite number Brown compounded Worcester's nervous start by missing an angled penalty attempt.
Northampton lost South African lock Selborne Boome to a 14th-minute injury – Damien Browne replaced him – which was the cue for Worcester's first threatening attack, and they made it count.
Saints repelled the first attacking wave, but their blindside defence fell asleep to allow sniping Powell a try that Brown converted for a tense 7-6 lead after 20 minutes.
The lead though, lasted barely seven minutes as Saints regained their composure and unleashed full-back Bruce Reihana, whose pace and superbly-delivered pass sent England Under-21 wing Diggin dashing over.
Drahm compounded Warriors' misery by converting from the touchline, showing nerves of steel amid intense pressure to put Northampton back in charge.
Worcester had their hands full against a lively and inventive Saints outfit, and Saints pressed for another score as half-time approached.
But Worcester weathered the storm, and Powell launched a thrilling counter-attack from inside his own half that ultimately took its toll when Saints' close-quarter defence was again found wanting and Rasmussen powered over. Brown converted for a 14-13 interval lead.
Worcester had an immediate opportunity after the restart to extend their lead, but Brown sent a straightforward penalty chance wide and then could not find the target with two 30-metre drop-goal attempts.
Brown's inaccuracy proved in stark contrast to Drahm's consistency, and with both packs fighting out a stalemate, goalkicking success grew increasingly important.
Drahm then got a case of the jitters, landing a drop-goal strike short as both sides struggled to regain their first-half fluency.
It took Saints 15 minutes of the second period to threaten Worcester's line, but Diggin slipped as he broke into enemy territory and the home side cleared the danger.
Skill levels dipped considerably, but it came as no surprise, given how much was at stake, and the third quarter ended scoreless as Worcester held their one-point advantage.
Drahm though, then brilliantly found his range from 48 metres to put Saints back in front and herald a gripping closing minutes.
Referee Chris White should have reversed a penalty in Worcester's favour when a Warriors player was floored off the ball, but Saints escaped censure.
Hickey though, then struck for his winning try, and Hayes' conversion ensured Worcester were safe – despite Grayson's late drop-goal – whatever happened elsewhere.
For Worcester:Tries: Powell, Rasmussen, HickeyCons: Brown 2, Hayes
For Northampton:Tries: DigginCon: DrahmPens: Drahm 3Drop Goal: Grayson
Worcester Warriors: 15 Thinus Delport, 14 Giscard Pieters, 13 Dale Rasmussen, 12 Thomas Lombard, 11 Ben Hinshelwood, 10 James Brown, 9 Matt Powell, 8 Drew Hickey, 7 Pat Sanderson (capt), 6 Siaosi Vaili, 5 Craig Gillies, 4 Phil Murphy, 3 Chris Horsman, 2 Andre van Niekerk, 1 Tony Windo.Replacements: 16 Neil Lyman, 17 Ben Daly, 18 Richard Blaze, 19 Neil Mason, 20 Neil Cole, 21 Tommy Hayes, 22 Daren O'Leary
Northampton Saints: 15 Bruce Reihana, 14 John Rudd, 13 Ben Cohen, 12 Marc Stcherbina, 11 Paul Diggin, 10 Paul Grayson, 9 Billy Fulton, 8 Mark Soden, 7 Corne Krige, 6 Darren Fox, 5 Matt Lord, 4 Selborne Boome, 3 Brett Sturgess, 2 Steve Thompson (c), 1 Simon Emms Replacements: 16 Dan Richmond, 17 Chris Budgen, 18 Damien Browne, 19 Ross Beattie, 20 Johnny Howard, 21 Luke Myring, 22 Shane Drahm
Referee: Chris WhiteTouch judges: Ashley Reay, Steve TerheegeAssessor: Ed Morrison