Defender Rugani forced home the decisive goal from a tight angle in the fifth and final minute of stoppage time in Turin to cut the gap between Juve and league leaders Inter Milan to six points.
Hosts Juve looked set for another embarrassing result after goals from Walid Cheddira and Marco Brescianini cancelled out Dusan Vlahovic’s first-half brace.
But Rugani managed to get his boot on Vlahovic’s flick-on from a corner and get Juve going back in the right direction.
“I’m really happy because a goal like that in the last minute, I couldn’t have asked for more. I’m happy to have the team win. Let’s take the positive and go again,” said Rugani to Sky Sport.
“I realised where the ball was going, I stretched for it and I managed to reach it.”
Sunday’s win made Juve coach Massimiliano Allegri the first in Serie A history to get more than a thousand points, his total now at 1,002 according to statistics provider Opta.
Inter can re-establish their nine-point lead later on Sunday when they face Lecce.
Leaders Inter could go into next weekend’s fixtures a full 12 points ahead of Juve as they also have a game in hand against in-form Atalanta on Wednesday.
Rugani’s goal also gave Juve a five-point cushion between them and AC Milan who host Atalanta at the San Siro in Sunday’s late match.
Frosinone are 16th and three points above the relegation zone after a fourth straight defeat for Eusebio Di Francesco’s leaky side, with 14 goals conceded in that run.
The away team played well and were briefly leading when Brescianini rifled in a brilliant finish in the 27th minute, only for Vlahovic to level with his second of the day five minutes later.
“The late goal is a huge shame, things are not going our way and it’s a real source of regret,” said Di Francesco to Sky.
“Every match there is regret about the result. It’s a huge disappointment.”
Later Napoli try to reignite their hopes of European football at Cagliari in Francesco Calzona’s first league match with the ailing Italian champions.
Calzona made a positive start to his new job on Wednesday night when Napoli drew 1-1 with Barcelona in the last 16 of the Champions League.
Napoli are ninth, five points from the European spots and a huge 12 behind fourth-placed Bologna who sit in the final Champion League spot after beating Verona on Friday night.