Lemar scored with a powerful shot from inside the box in the 113th minute after Marseille had come from behind three times.
Monaco went ahead in the 16th minute thanks to keeper Yohann Pele's own goal before Dimitri Payet equalised with a fine half-volley on the stroke of halftime, as the hosts sought to put Sunday's 5-1 home league hammering by PSG behind them.
Olympique de Marseille's French forward Dimitri Payet (2nd L) scores a goal during the French Cup football match between Marseille (OM) and Monaco (ASM) on March 1st, 2017 at the Velodrome stadium in Marseille, southern France.
Image credit: AFP
Monaco's 18-year-old forward Kylian Mbappe then scored his seventh goal in his last five starts when he cleverly turned in Benjamin Mendy's cross from the right in the 66th minute.
Remi Cabella, however, sent the tie into extra time when he found the net from close range in the 84th.
Mendy put the visitors ahead again in the 105th minute after being set up by a pass from Mbappe, but Cabella equalised six minutes later. There was no coming back for the hosts, however, after Lemar rifled home.
Monaco's French midfielder Thomas Lemar celebrates after scoring his team's fourth goal during the French Cup football match Marseille (OM) vs Monaco (ASM) on March 1, 2017 at the Velodrome stadium in Marseille, southern France.
Image credit: AFP
Monaco, who will take on PSG in the League Cup final next month, could also face the French Cup holders in the next round after they fielded a largely reserve side and beat Niort 2-0.
PSG struggled on a damp pitch in the rain but late goals from second-half substitutes Javier Pastore in the 78th minute and Edinson Cavani in stoppage time secured victory for the French champions.