The Sharks trailed 7-6 in the closing stages but looked to have done enough to clinch top spot in Pool One as they clung to a losing bonus point in France.
However, full-back Miller held his nerve to kick a third penalty two minutes from time to win the match and claim a home tie in the knock-out stage as third seeds in the last eight.
Victory owed just as much to the Sale defence, who held off their hosts for more than an hour.
Montpellier thump Quins to reach European Challenge Cup quarter-finals
Biarritz flying machine Taku Ngwenya ran in the opening score, converted by Julien Peyrelongue on 18 minutes.
The Sharks had closed the gap to a single point within seven minutes through a brace of penalties by Miller.
From there on in their defence took over. Biarritz threw everything at them, but the Sharks' tacklers lined up to cut down wave after wave of attacks.
Miller missed two kickable penalties, one in each half, as the tension mounted, but kept his cool late on to hand the visitors a crucial win.
Bath boss Mike Ford: England quartet have no fear
Harlequins win at Stade Francais to make semis