The Greek team took the lead in the fourth minute when Greco swerved past three defenders to set up Djamel Abdoun's strike that hit the post, the rebound falling for Paulo Machado to tap the ball into the net.
Montpellier hit back from the penalty spot in the 66th minute through Younes Belhanda.
But Olympiakos shook off a patch of lackluster form with goals from Greco in the 80th minute and Costas Mitroglou in the 82nd.
"It's great that we pulled it off and gave our fans some joy," Machado said. "We are still in there with a chance and we'll be positive when we go into our next match against Schalke, and of course play to win."
Olympiakos coach Leonardo Jardim said his team's good organization was key for the result.
"We got the early goal and were mindful not to concede. We managed to stop them developing their attacks, defending well when they pushed forward," he said.
"Our players are physically strong, and that was important, and allowed us to score the (winning) goals at the end of the match."
About 100 French fans clashed with riot police at Karaiskakis Stadium before the match started.
"It wasn't a lack of experience. It was mistakes that cost us the game -- at the start and end of the match," Montpellier coach Rene Girard said. "There was a lack of concentration from our players, and at this level you pay the price for it.
"This was a good adventure for is. Playing in the Champions League will help our team mature."
Olympiakos put on early pressure and nearly grabbed a second goal through Mitroglou, who spun around in the area but aimed the ball straight at goalkeeper Geoffrey Jourden in the 11th minute.
The Greeks immediately dropped back, allowing the Montpellier to dominate much of the first half but relying heavily on winger Belhanda to set up chances.
In the 18th, Soulaymane Camara caught out Olympiakos goalkeeper Roy Carroll but headed over the bar.
Montpellier swapped Remy Cabella with striker Gaetan Charbonnier in the second half to push for the equalizer.
Carroll sprinted to deny substitute Jonathan Tinhan in the 63rd.
But the visitor's goal came three minutes later after Croatian referee Marijo Strahonja ruled Dimitris Siovas brought down Camara in the penalty area. Belhanda slotted the spot kick.
Olympiakos looked unable to contain the pacey French, but a late recovery resulted in Greco firing past Jourden after a poor clearance from a corner.
Mitroglou sealed the win by meeting a cross from Jose Holebas with a powerful finish.
"The penalty woke us up. We took it personally and it spurred is to start playing better," Olympiakos midfielder Yiannis Maniatis said.
"We knew that Montpellier is not a huge force in Europe, so it's great that this finally came together. The result will help us player or next games without so much stress."
The Greeks have won eight of their nine league games to lead domestically, while Montpellier have failed to repeat its surprise run last season to the French title and is currently 14th in the 20-team league.
From Our Network
- Shah Rukh Khan is really impressed with his 'Raees' co-stars
- Laughing Buddha: Which one to use and where to place?
- After Jennifer Winget, Karan Singh Grover’s first wife Shraddha Nigam speaks up on his wedding with Bipasha Basu
- Controversial leaked images of Southern actresses
- Former IAF chief S P Tyagi cracks, admits meeting Finnmeccanica officials