Robinson went over in the 80th minute to sign off in style
Sale: (13) 25
Tries: Fernandez Lobbe, Kuadey, Robinson
Cons: Thomas 2
Pens: Thomas 2
Bath: (9) 23
Tries: Walshe, Barnes
Cons: Barkley 2
Pens: Barkley 3
Jason Robinson ended his glittering club career with a match-winning try 10 seconds from time as Sale edged past Bath in the Guinness Premiership.
Juan Martin Fernandez Lobbe's converted try and two Lee Thomas penalties helped the Sharks into a 13-3 lead.
But Nick Walshe and David Barnes scored tries just after the break as Bath rattled up 20 unanswered points.
Selorm Kuadey put Sale back in touch with a converted try before cross-code legend Robinson signed off in style.
The former Wigan and Great Britain rugby league star will remain available for England until the end of their World Cup campaign but brought down the curtain on his club career in front of his home fans at Edgeley Park.
Bath took the lead through an Olly Barkley penalty before the out of favour England centre's sliced clearance was collected by Sebastien Chabal.
Sale's French number eight took out two defenders before feeding Chris Mayor, who sent Argentine flanker Fernandez Lobbe over for the first try of the night.
Thomas slotted the conversion and added two penalties but Barkley replied in kind to narrow the gap to 13-9 at the break.
Bath started the second half strongly despite losing flanker Michael Lipman, who was stretchered off after a lengthy delay and subsequently taken to hospital as a precaution.
First scrum-half Walshe scored and five minutes later he sent prop Barnes over, with Barkley converting both scores to put Bath 10 points clear.
Sale went back on the attack and, with Bath down to 14 men after Eloita Fuimaono-Sapolu was sin-binned, they narrowed the gap when Robinson's pass put Kuadey over in the corner and Thomas landed the conversion.
The stage was all set for a fairytale finish and it duly arrived with 10 seconds left on the clock.
Robinson burst onto the ball 30 metres out and tore past the Bath defence to bid farewell to the adoring Sale faithful in style.
He then missed the conversion but few at Edgeley Park cared as the Sharks collected a first victory since January.
Sale boss Philippe Saint Andre:
"It's typical Jason Robinson. When you thought we have lost a game and the first time we get two passes, he does what he does best.
"He hit the line in space and we scored. It's a fantastic finish for Jason and I just hope if he is bored after the World Cup he wants a few games with us. He's more than welcome!
"I'm very pleased for Jason to win because we don't win things generally and he deserved to finish with Sale with a win - it's a fantastic story."
Bath coach Steve Meehan:
"It's one of those things. You think it can't happen but it did, which is fantastic for him (Robinson).
"But we've got one match to go to get our first away victory of the year. We thought we were there but that's sport - it's cruel.
"We didn't do ourselves any favours and we've got to have a look at all the penalties we gave away and the execution - the way we played over the last 10 minutes just wasn't up to scratch."
Sale: Robinson; Mayor, Sevealai'i, Bell, Kuadey; Thomas, Foden; Roberts, Bruno, Stewart, C Jones, Schofield, J Fernandez Lobbe, Lund, Chabal.
Replacements: Titterrell, Turner, Cox, Day, Wigglesworth, R Jones, Taylor.
Bath: Abendanon; Stephenson, Walker, Barkley, Cheeseman; Berne, Walshe; Barnes, Mears, Stevens, Borthwick, Grewcock, Beattie, Lipman, Faamatuainu.
Replacements: Dixon, Jarvis, Louw, Short, Scaysbrook, Williams, Fuimaono-Sapolu.
Referee: Wayne Barnes (England).