New York was leading 4-2 when Houston loaded the bases with one out against Billy Wagner, who had converted 13 of his previous 14 save chances. Pinch-hitter Geoff Blum then lined a single to left and Pence raced around third, right on Loretta's heels.
In an image reminiscent of a scene in the baseball movie "Major League," both players slid in safely in a three-player collision with catcher Ramon Castro.
Loretta crashed into Castro first and the force of the blow jarred the ball loose.
"I felt like a fullback going in there," Loretta said. "It was like a car wreck."
Like a tailback sneaking across the goal line, Pence scored an instant later.
"He just opened up a little spot for me to touch the plate," Pence said.
A dazed Castro, meanwhile, sprained his right ankle and left the game.
"I didn't see it. I got hit," Castro said. "I went back and then the ball came out. I saw the first guy and then I was on the ground."
Wagner grabbed the loose ball and tagged Loretta, but umpire Tim Welke ruled both runners had touched the plate. Wagner wasn't so sure, but didn't argue.
"I didn't think Pence had," Wagner said. "But Pence had already taken off. He was pretty much in the dugout and there's no way for the umpire to see. He was blocked the whole time."
Pedro Feliciano relieved and struck out Michael Bourn. He issued an intentional walk to Pence before Erstad sliced a 3-2 pitch toward Fernando Tatis in left field. Tatis fell down as he caught it and Berkman scored the winning run.
"That was a fun game to be involved in," Houston manager Cecil Cooper said. "That was an exciting one."
It was a costly loss for New York, which has dropped five of six to fall into third in the NL East. The Mets are two games back of Philadelphia and trail Florida by a half-game.
Jose Valverde (5-3) pitched a scoreless 10th to pick up the victory and Kaz Matsui hit a solo homer in the eighth for the Astros, who have won five of six.
Wagner's blown save against his former team ruined a strong start from Johan Santana, who threw 6 1/3 solid innings and has been repeatedly let down by his bullpen this season.
"Those are things I can't control," Santana said. "Unfortunately, this game, they judge you for that, they criticize winning or losing a game. That's the way it goes. It happened in the past and there's nothing I can really do."
Santana didn't allow a baserunner for three innings. Matsui led off the Houston fourth with a triple to left-center and Santana hit Berkman with a pitch with one out.
Lee singled to score Matsui, prompting a mound visit from pitching coach Dan Warthen. Santana walked Loretta to load the bases, but struck out Pence and retired Erstad on a popup to get out of the inning.
"He's a great pitcher, very tough," said Berkman, who went 0-for-3. "He's got two very good pitches and we kind of hung in there. That's why it's so important, even when the team gets up three or four runs, you have to stop the bleeding."
Oswalt reached 100 pitches in the sixth, his highest total since June 25, the start before he strained his left hip. He sat out two weeks, then allowed four runs in his return start on Monday, a 5-4 victory over Cincinnati.
Tim Byrdak and LaTroy Hawkins, acquired in a trade with the New York Yankees on Wednesday, combined to retire the Mets in the seventh, with Hawkins striking out two of the three batters he faced in his Houston debut.
"I was battling, doing my job and trying to give the team a chance to win," Santana said. "We took the lead and I was just protecting the lead, hoping everything winds up the way everybody wants. Unfortunately, that didn't happen."
Pinch-hitter Ty Wigginton hit a drive to the left-field wall, but Daniel Murphy made a leaping catch. Pence was already halfway to third and Murphy made a perfect throw to second, where Easley tagged him to complete the double play.
Murphy also scored a run in his major league debut. He was called up from Triple-A New Orleans before the game, taking the spot vacated when Marlon Anderson was put on the disabled list with a strained left hamstring.
The Astros have hit 14 home runs in their last seven games. ... Beltran batted in the No. 2 spot for the first time this season. Manuel said he was trying to kick-start Beltran, who came into the game with seven hits in his last 35 at-bats. ... The Mets have gone 11 straight games without an error. ... Castro said he was OK after the game, and Manuel said the catcher was day to day.