MIAMI (AP) -- When Casey McGehee was ruled out on strikes to end the game, he protested the call and pursued the umpire toward the locker room for several steps, angrily waving his arm and tossing aside his helmet and bat.
Thus ended a night of frustration for the Miami Marlins. They gave up two unearned runs, walked in a run, didn't reach second base until the ninth inning and lost Wednesday to the St. Louis Cardinals 5-2.
The Marlins were going for their first three-game sweep of the Cardinals since 1996. But they couldn't muster much of a challenge against Justin Masterson, who pitched seven scoreless innings in his best outing since joining St. Louis.
"Absolutely we wanted to get greedy and try to go for the sweep," McGehee said. "But Masterson threw the ball well."
"We didn't help ourselves out defensively," manager Mike Redmond said. "We gave them a few extra outs there and they took advantage of them. That's what good teams do, and we know that's not us. We need to make those plays and help our pitchers. You start talking about playing meaningful games, you've got to make plays."
Jeff Baker had a two-run homer in the ninth for the Marlins, but they totaled only five hits. NL home run and RBI leader Giancarlo Stanton went 0 for 4 with two strikeouts.
Masterson earned his first career RBI in the sixth with a two-out single. He was more excited about pitching seven scoreless innings in his best outing since being acquired in a trade with Cleveland on July 30.
"I pray to the good lord that this is on the right path," said Masterson, who has struggled for much of the season. "I felt very comfortable. The ball was coming out well and it was heavy. And it was going at guys; that's nice too."
The 6-foot-6 sinkerballer recorded 12 outs on groundballs. He also bounced a grounder through the Miami infield for his RBI, and when asked if he got the ball as a souvenir, he laughed.
"I got a `W,'" he said. "It's much better for the team than the ball."
Masterson improved to 2-1 with St. Louis and 5-6 overall. He allowed three hits -- all singles -- and no walks and threw only 91 pitches before departing for a pinch hitter.
After recording only six outs in his previous start, he lowered his ERA to 6.00 in three outings with the Cardinals, and 5.14 overall this year.
Redmond caught Masterson in 2010 when both were with the Indians.
"He's a totally different guy than I caught," Redmond said. "He definitely relies on his location and changes speeds, but he still gets a ton of groundballs. We never got anything going against him."
Redmond also caught the Marlins' starter Thursday, Brad Penny, when both played for Florida.
Cardinals LF Matt Holliday left the game in the seventh inning when his chronic knee trouble flared up, but he said the problem wasn't serious.
Marlins LHP Dan Jennings, who suffered a concussion when he was hit in the head by a line drive on Aug. 7, has been free of symptoms the past two days and played catch before the game. There's no timetable yet for his return.