Torrealba homered, then threw out Darren Ford on an attempted steal of second base for a double play that ended Saturday's 1-0 win over the San Francisco Giants.
San Francisco had won the first two games of the series, closing within one percentage point in the division race as the Padres lost for the 13th time in 15 games. The victory boosted San Diego's margin back to one game.
"Torrealba pretty much won the game for us," Padres closer Heath Bell said. "He hasn't been hitting the ball lately, then he hits a home run. Then he comes up big by throwing Ford out. With us, you never know who is going to come up big."
Tim Stauffer (4-3), a long reliever making his third start of the season, allowed three hits in six innings and pitched out of his only jam in the second. Stauffer is 1-0 with a 0.60 ERA in those starts.
"Amazing. Amazing," Torrealba said of Stauffer's outing. "He's been in the bullpen all year long, and for him to step up and keep us in the game, it was amazing."
Three relievers completed the three-hitter, with Bell getting his 40th save in 43 chances after Luke Gregerson and Mike Adams pitched an inning each. Bell reached 40 saves for the second straight season.
"That's how we have done it all year," Bell said. "It stands out more now, though, because we lost most of our lead and we are getting it back in September, when everyone is paying attention."
San Diego, which has not been out of first place since June 16, had a 6½-game lead before play on Aug. 26. The Padres have 21 games remaining and the Giants have 19.
San Francisco, which had won nine of 12, hasn't been in first place since May 6.
"We just couldn't do anything offensively," Giants manager Bruce Bochy said. "We had an opportunity but just couldn't cash it in."
The teams complete the series Sunday, with the red-hot Mat Latos (14-5) starting for Padres against two-time NL Cy Young Award winner Tim Lincecum (13-9).
"If we win Sunday, it puts them two games back and, basically, puts us in the driver's seat again," Bell said.
It will be hard for Sunday's game to match the drama of Saturday's.
Aubrey Huff was hit in the right elbow by a pitch with one out — Huff also was hit in the same spot Friday and scored in San Francisco's 1-0 win. But Bell closed out this victory when Buster Posey struck out, and Torrealba threw out Ford, who pinch ran for Huff.
Rookie Madison Bumgarner (5-5) allowed three hits in seven innings, retiring 13 straight batters after Torrealba's homer. He has allowed two runs or fewer in five of his last six starts.
"One pitch," Bumgarner said. "That's just the way it goes sometimes. He just got me. I don't know it was that bad of a pitch."
Stauffer worked his way out of trouble after Jose Guillen doubled with one out in the second, Pat Burrell walked and Jose Uribe singled. Stauffer retired Edgar Renteria on a popout and Bumgarner on a groundout.
"Once I got through the second, I didn't really labor too much," Stauffer said after his longest outing this season. "I felt really good out there and just tried not to think too much about the fact I hadn't pitch this long for a while."
Stauffer made an emergency start Monday against the Los Angeles Dodgers in place of Latos, who was ill, and pitched four strong innings as the Padres stopped a 10-game skid with a 4-2 win.
Torrealba's fifth homer landed in the right-field porch in the third inning. The drive on an 0-1 pitch landed about five rows deep. Torrealba had two of the Padres' four hits.
"When I hit it, I thought it was going to go off the wall," Torrealba said.
San Diego has won six 1-0 games, including three against the Giants. The offense-challenged Padres were held to four runs or fewer for the 15th straight game, the club's longest such streak since 1990 when they did it in 16 consecutive games.
NOTES: The only other time the Padres had a game-ending double-play consisting of a strikeout and throwing a runner out attempting to steal was Sept. 10, 1970 against Atlanta. ... Giants 3B Pablo Sandoval was held out of the starting lineup for the second straight game. Sandoval is hitting .167 (3 for 18) in the first eight games of a 10-game trip. Bochy said Sandoval was expected to start in Sunday's finale. ... Padres manager Bud Black said utilityman Jerry Hairston Jr. (right elbow sprain) and CF Tony Gwynn (broken right hamate) will both travel with the club when for the start of a 10-game trip Monday in Colorado. Both players are expected to come off the 15-day DL.