Nigerian striker Terem Moffi struck twice for the visitors but hobbled off with an injury before Lirola won the game at the death.
"Beyond the emotion of the result and keeping our 100% record at the Velodrome, there are lots of things to correct," Sampaoli, who has overseen four home wins in four since his appointment, said.
"I don't know if these highs and lows are part of my style, I hope not. It's tough on the heart."
"We need to have more control," he added. "We need to learn from it and get better. Dominating a match but having so many ups and downs is not good. We have to control the game more."
Moffi, Lorient's top scorer after his October arrival from Belgian club Kortrijk, finished off a sharp counter-attack to give the Bretons a first-half lead.
The hosts had picked up 10 points from a possible 15 since the appointment of Sampaoli, and they levelled through a sensational Dimitri Payet volley on 53 minutes.
Lirola put Marseille on top three minutes later after a neat ball through by Florian Thauvin, the Spaniard opening his account having joined on loan from Fiorentina at the start of the year.
Moffi looked to have earned a vital point for Lorient in its fight against relegation when he raced clear to score for the second time – his 11th goal of the season – with 20 minutes to go.
But Lirola fired in a low drive from the corner of the area to snatch victory late on for Marseille, securing its fourth win in six games under Sampaoli.
Marseille moved level on points with fifth-placed Lens and climbed back above Rennes, which eased to a 3-0 victory away to Angers earlier in the day.