Cagliari went ahead in Parma when Chile's Arturo Vidal fouled Marco Sau in the area and Chilean striker Mauricio Pinilla dispatched the 16th-minute penalty.
Juve appealed for their own spot-kick late in the first half after Davide Astori tangled with Fabio Quagliarella but the referee waved away the protests.
The champions went close again after the break when Leonardo Bonucci hit the post and they had another penalty turned down before Cagliari defender Astori was dismissed 20 minutes into the second half for two bookings.
Cagliari coach Ivo Pulga was sent from the dugout for protesting but the Sardinians smiled when the off-colour Vidal blasted a penalty into the stands, only for substitute Mirko Vucinic to set up Matri for Juve's equaliser on 75 minutes.
Antonio Conte's Juve poured forward in the closing stages but Cagliari keeper Michael Agazzi was in fine form until the ball rebounded off Vidal into Matri's path and he scored in stoppage-time before Vucinic added a flattering third.
Cagliari appealed for handball against Vidal for Juve's second but replays were inconclusive.
"It is an important signal to the other teams who play tomorrow. They play with a bit more pressure after tonight," striker Matri told Sky Italia television.
"It's been a while that I have been looking for goals, finally it has happened but I believed in myself.
"Cagliari will always be a team in my heart, they launched my career."
The game was played in Parma after authorities ruled Cagliari's ground was unsafe for such a high-profile fixture against Italy's best supported club.
Fans of the Sardinian outfit were furious that the league only switched the game to Parma, much nearer Turin and on the mainland, two days before kick-off in an all-too familiar occurrence in Serie A.
In Friday's other Italian match, Pescara climbed out of the drop zone after Romulo Togni netted his first league goal with an injury-time free-kick to seal a 2-1 home win over eighth-placed Catania.
Togni burst into tears with delight even though the winner was largely down to bad positioning by Catania goalkeeper Mariano Andujar.
Mervan Celik opened the scoring for the hosts midway through the first half but Pablo Barrientos soon equalised for the Sicilians, who dominated the match and will wonder how they lost against the promoted outfit.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.