The reigning champions were off-colour at the Stadio Luigi Ferraris and an under-strength team struggled to dominate an enterprising Genoa side.
Dani Osvaldo had two goals ruled out for narrow offside calls in the first half while Genoa's Emanuele Calaio saw his penalty saved by veteran goalkeeper Gianluigi Buffon with 20 minutes remaining.
Juve looked poised to settle for a single point but Pirlo stepped up to boost the Turin outfit well clear of second-placed Roma's reach with a trademark free-kick at the death.
It would be a bad-tempered encounter at the Marassi - four Genoa players were booked before half-time - but Osvaldo somehow managed to keep his cool despite suffering two personal setbacks.
The on-loan Southampton striker, exiled from England following a fiery training-ground bust-up, put the ball in the back of the net twice only for the offside flag to overrule both efforts.
The first false start occurred in the 21st minute when Osvaldo raced through the Genoa backline to collect Fernando Llorente's deflected pass and beat Mattia Perin.
But as he looked over to the touchline, he saw the flag shoot up.
Juve went close again when Pirlo sent Llorente through on goal but Giuseppe Sculli made the clearance at the last minute.
In the 38th minute it was Genoa's turn to threaten.
Andrea Bertolacci headed towards the far corner, watched his effort veer just wide, then remonstrated angrily with Stephan Lichtsteiner for manhandling him in the build-up.
A sublime piece of individual skill from Paul Pogba then saw Osvaldo clip home for the second time.
A deft backheel sent the former Roma man through on the left and he beat Perin, only for the flag to deny him again.
Just before the break, Bertolacci's attempt to find the top corner with his left boot took a fateful deflection and skipped over the bar.
The second half saw Buffon - making his 476th appearance for Juve - come to the rescue on numerous occasions.
The dangerous Bertolacci soon came knocking and Buffon did brilliantly to deny him before closing the angle to Marco Motta, whose daisy-cutter screamed wide.
Buffon steeled himself in the 71st minute when Arturo Vidal conceded a penalty for handling in the area.
Calaio stepped up but Buffon checked the flight of the ball and punched it clear to elicit a roar from the away fans.
Genoa knew they had wasted an invaluable opportunity and pushed hard to make amends before time ran out.
Luca Antonelli went close when he swung at a loose ball in the Juve box but Buffon gathered.
Two minutes from time, Pirlo won it for Juventus with a sublime free-kick.
As the ball sailed over the wall and into Perin's top corner with perfect precision, the league leaders had somehow managed to put three more points towards their bid for a third straight Scudetto.