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.
Challenge Cup
Montpellier thump Quins to reach European Challenge Cup quarter-finals
22/01/2016 AT 22:09
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.
Challenge Cup
Bath boss Mike Ford: England quartet have no fear
31/03/2015 AT 15:53
Challenge Cup
Harlequins win at Stade Francais to make semis
04/04/2014 AT 21:28