Serie A Review: Juve leave it late, Roma win thriller
The 35-year-old rifled in from 25 yards deep into second-half stoppage time to cruelly deny Torino and stretch his side's winning run at home in the league to 25 matches.
Juve looked destined to have to settle for a draw after Torino's Bruno Peres scored a superb individual goal midway through the first half, cancelling out Arturo Vidal's twice-taken penalty in the 15th minute.
The home side were even reduced to 10 men 12 minutes from time when Stephan Lichtsteiner was shown a second yellow card, but Pirlo popped up at the death to settle the clash.
Peres' goal was Torino's first against their fierce rivals since February 2002, and, until Pirlo's winner, it looked as though they would be the first visiting side to come away from a league game at Juventus Stadium with anything since Cagliari in May 2013.
Roma, meanwhile, kept up the pressure on leaders Juve, but had to overcome a stubborn Inter to register a 4-2 victory at Stadio Olimpico.
Gervinho tapped in from close range to open the scoring after 21 minutes before Andrea Ranocchia headed level from a corner 15 minutes later against the run of play.
Roma regained the lead two minutes into the second half when Jose Holebas smashed home, but Inter refused to go down without a fight - Pablo Daniel Osvaldo restoring parity with a deflected effort 10 minutes later.
However, Miralem Pjanic proved to be the difference between the sides - firing home from the centre of the penalty area on the hour before curling home a 25-yard free-kick in stoppage time.
The win keeps Roma within three points of Juve at the summit, while Inter suffered their first defeat since Roberto Mancini - who was sent off for dissent after Roma's third goal - returned to the club, and have now slipped to 11th.
Genoa's impressive season continued as they climbed to third with a 3-0 win at Cesena, although Napoli could reclaim that position by avoiding defeat at Sampdoria on Monday.
Jeremy Menez scored twice in a 2-0 victory for Milan over Udinese in the day's early kick-off, which saw both sides end the match with 10 men after Maurizio Domizzi and Michael Essien were given their marching orders during the second half.
The win sees Milan go fifth for the time being, while Udinese sit ninth.
There were also two red cards as Palermo beat Parma 2-1, while Mario Gomez scored his first goal since March in Fiorentina's 4-0 win at Cagliari.
In the day's remaining fixture, Empoli and Atalanta played out a goalless draw.