Although both teams looked to move the ball wide, two Nick Macleod penalties to Olly Barkley's one was all they had to show for their first half efforts, as the Sharks led 6-3 at the interval. The two kickers then traded three-pointers in the second period before Barkley levelled the scores.
But, in front of England head coach Stuart Lancaster, it was left to Miller to touch down late on and move the Sharks up to sixth in the Aviva Premiership
In the 20th minute, loosehead Andrew Sheridan was sin-binned for the hosts when he took out Dave Attwood at the lineout. Barkley converted the resultant penalty and Bath led 3-0.
Next it was Bath who sprung into action. Directed by the playmaking duo of Tom Heathcote and Barkley, the West Country side got to within 10 metres of the line before a poor Nick Abendanon chip through ended the move.
It was to prove costly as, from the following passage of play, the visitors were caught offside and Macleod kicked the three-pointer.
Sale's big ball-carriers had caused the opposition several problems throughout the first half - in particular prop Tony Buckley - and a second Macleod penalty saw the home side take the lead at the interval.
Kicking, scrums and lineouts started to take precedence, but it was the Sharks who were controlling the play better, and Macleod duly added another three-pointer.
However, after the hosts had made a hash of the restart, Barkley reduced the arrears immediately and then levelled matters with a third from the tee.
Yet, in a dramatic end to proceedings, full-back Miller latched onto a loose ball, kicked through before beating Abendanon to the touchdown. Macleod converted to effectively end Bath's Heineken Cup aspirations.