Rooney - who had a spell on loan with the Glovers in 2007 - inflicted a potentially fatal blow to their promotion hopes with a clinical second-half penalty before James Collins' late strike secured the win.
In a cagey first half, the hosts looked the most threatening with Joe Edwards scooping his shot over before Paddy Madden's effort was blocked.
Yeovil - who came into the game unbeaten in their last nine home league games - continued to dictate and came close to opening the scoring when Madden found James Hayter, who blazed over the bar.
However, the visitors hit back and should have gone into the interval ahead when defender Darren Ward's close-range effort crept narrowly wide.
The Wiltshire side improved in the second half with captain Alan McCormack fizzing a long-range drive wide before winger Gary Roberts lashed home - only for the goal to be disallowed for a foul on Kevin Dawson.
However, Rooney coolly converted 13 minutes from time after Marek Stech's foul on Roberts, and substitute Collins added a second at the death when he tucked in McCormack's pass.