Paris - Toulon kept their hopes of a fourth consecutive European Champions Cup title alive on Saturday but saw Wasps pip them to top spot in Pool 5.
The competition holders won 19-14 at Bath but Wasps got a bonus-point in defeating Leinster 51-10 to sneak ahead of Toulon atop the standings.
Both sides went through to the quarter-finals but Toulon now face an away tie against one of the other group winners.
"It's a huge satisfaction. OK, we finished second in the group despite having won five matches compared to Wasps' only winning four, but those are the rules regarding the bonus points," said Toulon manager Bernard Laporte.
"Anyway, Wasps deserved to qualify. It was up to us to deny them a (losing) bonus point at Mayol and even more so (a try bonus) at their place.
"But I'm very proud of our team because we're missing important players but that didn't stop us progressing."
This brutal encounter at Bath could have gone either way.
Australian full-back James O'Connor kicked two early penalties for Toulon before George Ford landed his first for the hosts.
But the reigning champions struck first in terms of tries after a Bath mistake.
The hosts turned over ball deep inside their own 22 and Toulon quickly moved it wide left for Steffon Armitage to brush off Ford and score on 19 minutes.
Another Ford penalty kept the English side in contention but they struggled to make any significant leeway against the well-drilled Toulon defence.
It was mostly a midfield slugfest but too often Bath lost field position due to simple handling errors or a lack of discipline as they trailed 11-6 at half-time.
Bath were a transformed outfit after the restart, though, and really took the game to Toulon with Anthony Watson finishing off a sweeping team move to score in the corner, despite what appeared to be a forward pass in the build-up.
Bath's tempo was explosive and they earnt a penalty in front of the posts that Ford kicked to give them the lead for the first time in the match.
But almost immediately, Bryan Habana picked off a risky David Denton loop pass and ran in unopposed to score a try.
Bath were now desperately trying to hold on as Toulon turned the screw.
But the tide turned again and Bath rolled downfield before winning a penalty from wide on the right, but Ford's effort drifted just past the upright.
O'Connor had the last word, kicking his third penalty, and although Bath had one last attacking chance to win the game, Toulon held firm.
In Coventry, Leinster struck first with a second minute Zane Kirchner try and Eoin Reddan's score on the half hour brought the Irish province back to 12-10.
But after that, Wasps started to pull away. Jimmy Gopperth, who finished with 19 points, notched their first try when finding a gap in the visiting defence while lock Joe Launchbury ran in the second try down the left.
Elliot Daly showed a stunning turn of pace to streak clear for the third before halftime and the forwards forced the bonus-point fourth just after the break with a rolling maul.
Wasps, who a week ago lost out on a famous victory at Toulon when Drew Mitchell scored a try after the final hooter, were buoyant and the points kept coming with New Zealander pair Frank Halai and Charles Piutau both crossing the whitewash, before South African prop Ashley Johnson rounded off the scoring with the seventh try two minutes from time.
Meanwhile, Ulster kept their quarter-final hopes alive with an eight-try, bonus-point 56-3 victory over Oyonnax.
Tries from Rob Herring, Darren Cave, Rory Scholes, Sean Reidy, Craig Gilroy, Robbie Diack, Ian Humphreys and Jared Payne meant Ulster finished the group stages on 18 points, well behind runaway pool A winners Saracens who ended with a perfect six wins from six after winning 28-17 at Toulouse.
But with only three of the five second-placed pool finishers reaching the knock-out stages, Ulster now face an anxious wait to see if they will be in the draw for the last eight.
European Champions Cup results in the final round of group games on Saturday:
Toulouse (FRA) 17 Saracens (ENG) 28
Ulster (IRL) 56 Oyonnax (FRA) 3
Glasgow (SCO) 22 Racing 92 (FRA) 5
Scarlets (WAL) 10 Northampton (ENG) 22
Bath (ENG) 14 Toulon (FRA) 19
Wasps (ENG) 51 Leinster (IRL) 10
Clermont (FRA) v Bordeaux-Begles (FRA)
Exeter (ENG) v Ospreys (WAL)
Stade Francais (FRA) v Leicester (ENG)
Treviso (ITA) v Munster (IRL)