With Chelsea going top of the group after hammering Belgium's Genk 5-0 at Stamford Bridge, the win puts Leverkusen second in the table and just a point behind as they now enjoy a four-point gap over third-placed Valencia.
The Spaniards will host Leverkusen in the return leg in Spain on November 1.
"We didn't play well in the first 45 minutes. We gave them far too much space in the first half, we almost invited them to shoot at our goal in the first 30 minutes," Ballack said. "We changed a few things at half-time and that really worked."
Ballack, 35, played his first 90 minutes of the season and set up the winning goal just after the break with a superb pass from the halfway line which split the defence for midfielder Sidney Sam to score.
"I was very happy with the pass, it was an important movement for us," said Ballack.
"We were pushing for a third goal once we got ahead. We didn't get it, but it was important we kept pushing forward."
The Spaniards had looked to have the game under control when Brazil striker Jonas put them ahead midway through the first-half, but Leverkusen fought back through goals by midfielders Andre Schürrle and Sam after the break.
Valencia were finally rewarded for their early pressure when Spain's Roberto Soldado found plenty of space down the left wing and his cross fell to the feet of Jonas who fired home from five metres.
It was no more than Valencia deserved having had nine shots on goal in the opening 25 minutes alone.
With Ballack playing in the middle of an attacking midfield, Leverkusen failed to threaten the Valencia goal until the 40th minute when Schürrle tested Valencia goalkeeper Diego Alves from long-range.
From the resulting corner, Ballack managed to get his head to the ball, but Leverkusen striker Steffan Kiessling fired wide.
Schürrle put his side level with his second goal in two games when he trapped a cross from the left wing and blasted home past Alves from 15 metres out on 51 minutes.
Midfielder Lars Bender forced Alves into a good save just moments later as Leverkusen asserted themselves.
Ballack showed he can still produce defence-splitting passes when he picked out Sam's run from deep to put the winger into space and Sam showed superb finishing to drill the winning goal past Alves on 56 minutes.
Sam's strike was obvious relief for Leverkusen coach Robin Dutt who was mobbed by his team after the goal-scorer sprinted to the bench to celebrate after a series of poor results.
"The coach has gotten a lot of stick in the press. We wanted to show that
we are fully behind him," explained Leverkusen goalkeeper Bernd Leno.