Cagliari took the lead when Chile's Arturo Vidal fouled Marco Sau in the area and Chilean striker Mauricio Pinilla dispatched the 16th-minute penalty.
Juve kept knocking on the door and after Davide Astori was sent off for two bookings midway through the second half, Matri pounced on two rebounds to score before Mirko Vucinic made it three, also in added time.
The game was played in Parma after authorities ruled Cagliari's ground was unsafe for such a high-profile fixture against the champions and league leaders, who can see their 10-point lead cut by the likes of Inter Milan on Saturday.
In Friday's other Serie A match, Pescara climbed out of the drop zone after Romulo Togni netted his first league goal with a stoppage-time free kick to seal a 2-1 home win over Catania. (Writing by Mark Meadows, editing by Ed Osmond)