Vincenzo Iaquinta had opened the scoring only to be sent off for a second bookable offence moments later, but Christian Poulsen came off the bench to secure a 2-1 victory in stoppages.
"We had lost our shape, but we are finding it again," smiled Ranieri after ending a run of two straight Serie A defeats.
"I was trying to find my team, which had gone missing in recent games and above all our shape and balance.
"Trezeguet is coming back from a long lay-off and had already played an hour on Wednesday in the Coppa Italia.
"Del Piero has played two excellent games, but I thought it right to give Iaquinta a chance, as he is finding his form again."