Tom James scores one of a hat-trick of tries for Cardiff Blues against Rugby Calvisano in the European Challenge Cup
Image credit: PA Sport
Quins were already guaranteed top spot in Pool Three and Montpellier knew they would need a handsome victory to join them in the quarter-finals as one of the three best runners-up.
It was a tall task, but the French side rose to it impressively with a 42-9 win, Harlequins' heaviest ever defeat in the competition.
Montpellier led 15-9 at half-time after tries from Jesse Mogg and Wiaan Liebenberg, but it was not until Yvan Reilhac crossed in the 77th minute that they were assured of the bonus point they needed.
That made it 33-9 and there was still time for Charles Geli to add a fifth try.
Cardiff Blues had hoped to leapfrog Montpellier and secure a last-eight spot themselves, but were left disappointed despite a 74-6 win over Rugby Calvisano.
Blues ran in 12 tries, including a hat-trick for Tom James, but it was not enough.
Worcester Warriors finished bottom of Pool Four after a 35-11 loss to La Rochelle in France.
It was La Rochelle's first home victory over an English side in the Challenge Cup since 2000.
Castres also finished their campaign on a high with a 24-7 victory over fellow Top 14 outfit Pau.