But the Brazil striker converted a penalty in the 90th and then followed up with a chipped pass for substitute Roberto to steer the ball beyond goalkeeper Kevin Trapp in injury time.
The winner sent Barcelona's bench flooding onto the pitch as the stadium celebrated the club's 10th consecutive appearance in the quarterfinals. Coach Luis Enrique, who announced he would leave the club this summer, embraced Neymar and any other player or staff member within reach.
"I don't think anybody stopped believing," Luis Enrique said. "I want to point to all those who kept their faith in us after we lost 4-0. This win is dedicated to them."
Barcelona played with all the intensity that PSG was lacking for the entire match, and didn't need its trademark passing attacks to get its first three goals.
PSG coach Unai Emery's strategy of not pressuring Barcelona backfired, as his team sat back and passively let the hosts hem them into their box.
The visitors' entire backline was frozen when Rafinha's routine cross came into the box in the third minute, and Luis Suarez was able to nod a bouncing ball over Trapp.
PSG was running scared from there on, lamely trying to hunker down in its area and wait for the clock to tick down.
Defender Layvin Kurzawa was at fault for Barcelona's second goal in the 40th, when he turned Andres Iniesta's back-heeled flick into his own net.
Another PSG defender, right back Thomas Meunier, was behind Messi's penalty in the 50th after he clumsily thrust his shoulder into Neymar's legs while trying to recover his position in the box.
Emery finally ordered his players briefly forward.
That was when Cavani stepped in for French champions, rifling in Kurzawa's headed pass.
But Barcelona never stopped pressing, despite needing three goals.
And Neymar led the way, pulling off one of the most remarkable sequences seen at the ground of the five-time champions.
He struck first with a curling free kick from the left flank that slipped inside Trapp's near post.
Next, he took responsibility for converting the spot kick after Suarez was shouldered down by Marquinhos in the box.
But the best was saved for last, when his pass was lofted over the defense and fell for Roberto to get his boot forward and turn the ball into the net.
Barcelona had set a precedent in the 2012-13 season's Round of 16 when it became the first team to erase a 2-0 away leg loss by roaring back to beat AC Milan 4-0.
But nothing compared to the challenge faced against PSG, a side that hadn't lost in 16 matches overall and completely outplayed Barcelona during the first leg in Paris.
It was a demoralizing end for PSG. The French side was on the verge of avenging quarterfinal exits to Barcelona in 2013 and 2015 and earning an elusive marquee victory that its Qatari owners were longing for. Instead, it must remain in the second-tier of talented but ultimately flawed European teams.
"We wasted a great chance and we know it," Emery said. "In the final minutes, we lost all that we had achieved."
In the night's other second-leg match, Pierre-Emerick Aubameyang scored a hat trick and Christian Pulisic claimed his first Champions League goal as Borussia Dortmund overcame Benfica 4-0 to advance with a 4-1 win on aggregate. The draw for the quarterfinals will be held in Nyon, Switzerland on March 17.
Greatest comebacks in sport - Where does it rank?
1 Oracle Team USA
There's no denying what Team New Zealand's tormenters managed to pull off in the 2013 America's Cup. Eight times Oracle were sailing in a do-or-die race in San Francisco and eight times they emerged triumphant, gradually eating away at Team New Zealand's 8-1 lead and eventually snatching the Auld Mug.
2 Mali
Today's result would have reminded many football fans of either Manchester United's two stoppage time goals to claim the Champions League in 1999 or Liverpool's revival from a 3-0 halftime deficit to win the same competition in 2005. But to avoid playing favourites here's a less familiar footballing miracle: Mali stunning Angola at the 2010 Africa Cup of Nations. After all, Mali's effort combined the speed of United and the goal glut of Liverpool, needing only 10 minutes to recover from a four-goal deficit and rescue a point against the host nation.
3 Boston Red Sox
What the Red Sox accomplished in 2004 will live long in baseball lore. Having been beaten up by the New York Yankees for all of 86 years, the Red Sox picked a hell of a way to find revenge over their hated rivals, winning four straight elimination games to overturn a 3-0 deficit in the American League Championship Series, the only baseball team in history to climb from such a hole.
4 New England Patriots
Is this the year of the comeback? 2017 began with the Tom Brady leading the Patriots to 34-28 overtime victory after his side were down 28-3 with 2:07 left in the third quarter. It's easily the biggest deficit to overcome to win a Super Bowl with the previous best being just 10 points.
5 All Blacks
The All Blacks at the time had never lost to Ireland and were gunning for a record 14-test unbeaten season in their final assignment. But they found themselves down 0-19 towards the end of the first quarter in Dublin. With time up, they still trailed by five but constructed an extraordinary 60m try - finished by replacement Ryan Crotty - built on composure and understated skill. With the scores at 22-all, Aaron Cruden's first sideline conversion attempt missed but he got another shot, thanks to an early Irish charge, and nailed it.