Pence's shot to left off Mitch Stetter (1-1) scored Lance Berkman, who had singled, to give Houston its sixth consecutive home victory.
"You know he's a guy who throws a pretty nasty cutter inside, so I was trying to relax my hands and just try to put the barrel on it," Pence said. "That's a huge win for us, a tough win and one we fought for. We showed a lot of resilience. They had a great guy in [ace Ben] Sheets on the mound, and somehow we managed to scratch a few runs off him and found a way to tie it up."
Berkman drove in four runs with a career-high-tying four hits, and Miguel Tejada extended his hitting streak to nine consecutive games as the Astros handed the Brewers their first sweep of the season.
"This was without question my biggest win as a manager, but I can't say enough about the guys today -- they all laid it on the line," Cooper said.
They did, and more.
They won a game in which Sheets had a four-run lead on them.
They came from behind despite trailing, 6-4, with one out in the ninth.
They won a game when their starting pitcher couldn't get through four innings.
The team that had three pinch-hits all season had three in one game.
"This was big, real big," Tejada said. "This was the kind of win [that] can help us later on."
"Any time you can snatch a victory out of the jaws of defeat, you're ahead of the game," Berkman said. "Whenever you can win games like this, you never feel like you're out of the game. That's a good mentality to have, and the only way you can get it is to be successful in coming through in some of these spots.
"Hunter is an example today. He had a tough day at the plate, but given the chance to win the game, he did. You've got to have guys that no matter what the circumstances are or what they've done personally, they're still fighting and doing the best they can when they go out there. We've always had guys here that have done that, and that's why we've been a successful franchise."
Trailing, 6-4, with one out in the ninth, the Astros used singles by pinch-hitters Darin Erstad and Geoff Blum and walks to Michael Bourn, Tejada and Berkman to push across a pair of runs against Brewers closer Eric Gagne to send the game to extra innings.
"I thought Lance's [at-bat] was really big," Cooper said. "He got ahead of [Gagne], 2-0, fouled off a couple and really worked it. We made them sweat and pushed two across. I thought Blum's at-bat was as big as any."
The Brewers loaded the bases in the 12th on three walks by Tim Byrdak (1-0), but the left-hander escaped the jam by retiring J.J. Hardy on a 3-2 fastball.
"We had been going fastball away, fastball away ... one just came back across the plate, [but] it got in enough that he popped it up to left," Byrdak said. "I was just struggling with my control a little bit today, working a little too fast, just wasn't catching up. Probably one of the ugliest box scores you'll see to ever get a win, but it worked out and we'll take it."
Mike Cameron hit two homers and drove in four, and Sheets came within two outs of improving to 5-0 before Houston's rally at Gagne's expense.
Cameron's second homer of the game, a three-run shot off reliever Dave Borkowski in the fourth, gave the Brewers and Sheets a 6-2 lead.
The Astros scored twice in the fifth on RBI doubles by Kazuo Matsui and Berkman.
Five of Milwaukee's runs were charged to Houston starter Chris Sampson, who allowed nine hits in 3 1/3 innings.
"It was just one of those days," Sampson said. "I think my sinker was sharp at times, but it kind of quit on me at other times."
Berkman led off the home half of the second with a home run into the right-field seats to cut Milwaukee's lead to 2-1. The homer was the 10th of the season for the Houston first baseman, the second most in the Major Leagues behind Philadelphia's Chase Utley (13).
The bullpen held the Brewers to one run during the final 8 2/3 innings as the Astros (16-16) reached .500 for only the second time this season.
"Last year they beat us a lot," Cooper said. "This is a big plus for us."