Substitute Jonathan Tinhan scored a late winner as Montpellier reached the League Cup semi-finals with a thrilling 3-2 home victory over Nice on Wednesday.
Tinhan latched on to a fine pass from Souleymane Camara to give Montpellier a deserved victory with the winning goal seven minutes from time.
Alexy Bosetti had put the visitors ahead in the 22nd minute, before Remy Cabella levelled eight minutes later.
Emanuel Herrera converted a neat cross from Anthony Mounier to put the defending French champions ahead seven minutes into the second half with his first goal of the season at home.
Eric Bautheac made it 2-2 from the penalty spot in the 66th minute after Montpellier goalkeeper Laurent Pionnier had brought down Neal Maupay.
Montpellier were denied what appeared to be an obvious penalty two minutes later after Nice defender Nemanja Pejcinovic handled the ball on his goalline, before Tinhan wrapped it up for the hosts.
"It's good for the audience, they saw five goals tonight... [but] we had a lead we could have preserved," Montpellier coach Rene Girard told French TV channel France 2.
"We had a difficult start to the season but our last five or six league and cup games were interesting," added Girard, whose team are unbeaten in their last seven domestic matches.
Saint-Etienne qualified for the last four on Tuesday after beating Paris Saint-Germain on penalties.comments