Kazuo Matsui, Brandon Backe and Carlos Lee had solo homers, all leading off innings against Martinez, who made his first start since July 12, when he left after four innings with tightness in his throwing shoulder. Martinez returned to the mound for the first time since the death of his father on July 23, and allowed five hits with five strikeouts in five innings.
Martinez struggled with his command, but felt no pain in the shoulder after 87 pitches.
"It was just nice to get back on the rubber and actually get back to pitching with all these distractions," he said. "I was rusty a little bit, the rust of not pitching in 20 days. I mainly lose a little bit of the touch for the pitches and the location. Once you let it go, there is no way to pull it back."
Lance Berkman, who went 1-for-4, thought he looked like the same old Pedro.
"He was better than the last time I faced him," Berkman said. "His breaking pitch was sharp. If he pitches like he did tonight, he's going to be tough."
The Mets loaded the bases with no outs in the seventh but didn't score as three different pitchers each got an out.
"That's probably where we lost the game, right there," Mets manager Jerry Manuel said.
Loretta didn't let the Astros miss their chance when they did the same in the eighth.
Miguel Tejada led off with a single against Heilman (1-5) and Berkman followed with a ground-rule double to center. Heilman intentionally walked Lee to get to Hunter Pence, who grounded into a forceout at home.
Loretta then hammered a 1-0 pitch into the porch in left field, his second pinch-hit homer this season and fourth of his career. It was the fifth pinch-hit homer for the Astros this season and their second grand slam in three games. Lee hit one in a 6-2 win over Cincinnati on Tuesday.
"I was just trying to make contact, use the middle of the field, get the run in and not hit a ground ball," said Loretta, who has two career grand slams. "I didn't expect to hit a home run."
Backe entered the game with an 8.18 ERA in first innings this season and the Mets scored in the opening frame.
Matsui tied it in the bottom of the inning, hitting Martinez's sixth pitch off the top of the bullpen fence in right for his third homer.
Backe led off the third with a homer to center, his second of the season and fourth of his career. Martinez retired the next three hitters, striking out Tejada and Berkman to end the inning.
"I wasn't able to execute on a couple of pitches and ended up giving up homers," Martinez said with a wry smile. "It was an amazing thing. Why not doubles? All homers."
Backe, meanwhile, retired nine straight batters following Wright's hit. With two outs in the fourth, the Mets strung together four straight singles to take a 3-2 lead.
Lee led off the fourth with a towering home run to center, his 25th.
Manuel said before the game that he wanted Martinez to throw about 70-80 pitches. He threw 75 in the first four innings and convinced the coaches he could go another inning.
"I knew he wanted to go out," Manuel said. "I knew he still had velocity."
Martinez walked Matsui on four pitches to open the inning. Tejada grounded into a double play and Berkman grounded out on Martinez's 87th pitch.
"We were trying to get 75 pitches in and I was able to go a little deeper," Martinez said. "The feeling of the game let me know I could go a little deeper or at least try. I don't regret it. I hope the next time out, I'm able to do that and do even better."
Joe Smith relieved Martinez for the sixth and set down the Astros in order.
The Mets loaded the bases with no outs on three straight singles in the seventh, but Houston's bullpen pitched out of the jam.
After Reyes singled to right to load the bases, left-hander Tim Byrdak relieved Backe and struck out Chavez. Houston manager Cecil Cooper then brought in Chris Sampson, who got Wright to ground into a forceout. Left-hander Wesley Wright replaced Sampson and retired Carlos Delgado on a fly to left.
- The Mets reached 10 hits for the 19th time in their last 29 games.
- Manuel said LHP Oliver Perez will start Sunday's series finale in place of RHP John Maine. Maine is nursing a strained rotator cuff and Manuel said he'll throw two bullpen sessions before making his next start against Florida next Friday.
- Astros CF Michael Bourn was out of the lineup for the fifth straight game with a sprained right ankle.