Morgan's two tries helped the Dragons to win in Bayonne
Bayonne: (8) 15
Tries: Vermis, Baget
Dragons: (3) 32
Tries: Morgan (2), A Brew, Hall
Cons: Sweeney (3)
Pens: Sweeney (2)
The Dragons got a quarter-final draw against Brive at Rodney Parade in the European Challenge Cup after a fine 15-32 comeback win over Bayonne.
The Dragons still feared an away draw, but Brive's failure to get a bonus point against Montauban cost them.
Trailing 8-3 at half-time in the Stade Jean Dauger, Dragons captain Kevin Morgan crossed twice after the break.
Tries from Aled Brew and Andrew Hall clinched the bonus point that won the group, ahead of Bristol on tries.
Dragons outside-half Ceri Sweeney opened the scoring in Bayonne with a penalty, before opposing locks Cedric Bergez and Luke Charteris were sin-binned for fighting.
The French side's number eight Marc Baget barged over, and outside-half Henri-Pierre Vermis added a penalty before half-time.
The boys don't like to do things easily
Dragons coach Paul Turner
Aled Brew went in at the corner shortly after the break, but a defensive lapse saw Vermis throw an outrageous dummy and cross under the posts.
He converted, and the visitors' hopes looked increasingly slim when Paul Emerick was sin-binned.
But a superb Michael Owen pass sent Morgan in for his first try, and then replacement back-rower Andrew Hall scored.
With just six minutes to go a sweeping Dragons attack saw Morgan in for his second and the crucial bonus-point.
"It wasn't a great performance and we were staring down the barrel, but we turned it around and won comfortably at the end," Dragons coach Paul Turner told BBC Sport Wales.
"The boys don't like to do things easily! But we'd said all week that it would be difficult in France, Bayonne are a top side who beat Stade Francais two weeks ago."
Bayonne: Fromont (Berberian 63), Lhande, Dourthe (captain), Onigo (Hegarty 15), Thierry (Ngog 40), Vermis (Ternisien 69), Rouet, Coetzee (Tomuli 61), Laurent (Heguy 40), Tomuli (Iguiniz 40), Linde. Bergez (Tewhata 40), Rudzki, Baget, Davies.
Yellow card: Cedric Bergez
Dragons: K Morgan (capt), G Wyatt, P Emerick, C Sweeney, A Brew, M Hercus, A Walker (G Cooper 49), A Black, B Daly (R Wilkes 80), L Harrison (G Robinson 29), I Gough (A Hall 60), L Charteris, C Charvis, M Owen (N Fitisemanu 60), J Ringer.
Yellow cards: Luke Charteris, Paul Emerick
Referee: Stefano Mancini (Italy)