The Blues stunned the visitors with a Rhys Patchell try after 43 seconds, but Montpellier hit back with three tries in 18 minutes to take a firm grip.
Josh Navidi and Lloyd Williams crossed either side of half-time before Alex Cuthbert's try put the Blues in front.
Navidi's second put the result beyond doubt, but Charles Geli's late try gave the French a bonus point.
The victory moves the Blues level on points at the top of Pool Three with Harlequins, who are expected to beat bottom club Calvisano on Saturday.
Montpellier would have returned home with two bonus points after Demetri Catrakilis' conversion brought them within seven points, but Patchell snatched it from them with the last kick of the game when he landed his second penalty.
It was a night to remember for Patchell, who was forced to move from fly-half to full-back moments before kick-off after Dan Fish injured his thigh in the warm-up.
He immediately shrugged off the disappointment of missing out on a rare start in his favoured position to give the Blues a perfect start with the game's first try, which he converted.
But Montpellier then looked a class apart as they showed precision and power to score three slick tries through prop Jamie Mackintosh and wings Timoci Nagusa and Julien Malzieu to open a 13-point advantage.
The Blues regrouped and clawed their way back into the match with two tries either side of half-time through flanker Navidi, converted again by Patchell, and then scrum-half Williams.
Moments before the home side's third try, Montpellier lost hooker Bismarck Du Plessis to the sin bin, and replacement lock Robins Tchale-Watchou soon followed to reduce the French to 13 men.
They survived without conceding a point, but then gifted the Blues a fourth try when a loose pass allowed Cuthbert to intercept and the Wales wing had enough pace to run from his own half to score.
Patchell stretched the advantage with another penalty and then Navidi's second score gave the Blues enough breathing space to mean Geli's late try did not prove too costly.
Cardiff Blues head coach Danny Wilson said: "It was a huge squad, both financially and physically, we were up against.
"We dug deep, and to score five tries and play the way we did is a great win.
"We've got a bit to work on in terms of what we are conceding - we seem to like to make it exciting here for some reason - but it's really pleasing to get a win."
Cardiff Blues: Rhys Patchell; Alex Cuthbert, Rey Lee-Lo, Gavin Evans, Tom James; Rhys Patchell, Lloyd Williams (capt); Sam Hobbs, Kristian Dacey, Tau Filise, Jarrad Hoeata, James Down, Macauley Cook, Josh Navidi, Josh Turnbull.
Replacements: Ethan Lewis, Gethin Jenkins, Craig Mitchell, Scott Andrews, Cam Dolan, Tavis Knoyle, Aled Summerhill, Garyn Smith.
Montpellier: Benjamin Fall; Timoci Nagusa, Anthony Tuitavke, Robert Ebersohn, Julien Malzieu; Benjamin Lucas, Benoit Paillaugue; Jamie Mackintosh, Bismarck Du Plessis, Pat Cilliers, Jacques Du Plessis, Paul Willemse, Wiaan Liebenberg, Antoine Battut (capt), Akapusi Qera.
Replacements: Charles Geli, Mikheil Nariashvili, Nicolas Mas, Robins Tchale-Watchou, Fulgence Ouedraogo, Cameron Wright, Demetri Catrakilis, Anthony Floch.
Referee: Peter Fitzgibbon (Ireland).
Touch judges: Leo Colgan (Ireland), Paul Haycock (Ireland).
Citing commissioner: Dave Guyan (England).
Media playback is not supported on this device
Cardiff Blues staged a rousing comeback for a bonus-point win over Montpellier in the European Challenge Cup.