The visitors took an early lead when Teddy Iribarren converted an early penalty, but Luke McAlister soon pulled Toulouse level.
© Getty Images
Timoci Nagusa scored a try for Montpellier as they went ahead again in the 33rd minute, but a late flurry from the home side saw Toulouse take a slender lead into the break.
However, Wynand Olivier fought his way over the line as the game fell back into the favour of Montpellier ten minutes into the second half.
Yoann Huget put the home side ahead for a second time before Iribarren kicked the visitors level once more with less than 20 minutes remaining.
In the final twist, Jean-Marc Doussain scored a 65th-minute try for Toulouse, who hung on to beat their French rivals.