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
Both clubs have endured tumultuous times recently. In the aftermath of their 45-9 humiliation to Saracens three weeks ago, Sale head coach Tony Hanks was the one who paid the price for their failings.
Meanwhile, their opposition in tonight's encounter have confirmed the departures of director of rugby Sir Ian McGeechan and first team coach Martin Haag at the end of the season.
It was the visitors who reacted the most positively to their recent travails. They dominated the opening exchanges and were unfortunate to see fly-half Tom Heathcote's
attempted kick slip wide of the upright.
However, with their first opportunity to strike, the Sharks almost forced their way over the line. Cillian Willis, on for the injured Dwayne Peel, Macleod and Sam Tuitupou all made bursts, but the move was ended when a penalty was awarded against the attacking team.
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.
Despite being down to 14 men, it was Sale who looked the more threatening. A break by Wales number eight Andy Powell almost led to a try, but the attack broke down when Matt Banahan intercepted a stray pass.
Next it was Bath who sprung into action. Directed by the playmaking duo of Heathcote and Barkley, the West Country 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.
With the rain lashing down for the start of the second period, the game descended into a scrappy affair.
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.
Gilbert has released a new line of rugby cleats. The Gilbert Virtuo 8S is part of the exciting new product. Check it out.
The Barbarians are one of the top invitational rugby sides with a long history and classic rugby jersey.
The Nike Tiempo is a solid rugby cleat and one of few styles still made from full-grain natural leather.
The Lions get ready for their matches with this green training jersey. It's what the players wear. Get in the Gear!
A cool looking all black rugby cleat with the high performance adidas is known for. Get in the Gear!
Wear the crest of the British and Irish Lions on your t-shirt. A great look for the summer.
$29.99
The Lions are ready to get their Australia tour underway. They arrive in Perth on Monday.
The New Zealand All Blacks training jersey for 2013/14. Get in the Gear!
The USA Rugby Pro Alternate rugby jersey is perfect for any fan of the Eagles. Get yours to wear during the summer Test matches.
The NEW All Blacks 2013/14 jersey has arrived at World Rugby Shop. Dare to wear the colors of the All Blacks.