ST. LOUIS -- Less than 24 hours earlier, it seemed every ball the Giants put in play found a hole. But on Thursday afternoon, San Francisco, which had been clicking from top to bottom, couldn't catch a break.
As second baseman Marco Scutaro put it -- sometimes that's baseball.
"That's the beauty of this game," Scutaro said. "You can't predict what's going to happen tomorrow. You never know. That's the way it goes."
St. Louis starter Adam Wainwright stifled the Giants' offense, and Carlos Beltran's two-run homer with two outs in the first spoiled a solid outing from Madison Bumgarner as San Francisco dropped a 3-1 loss at Busch Stadium in the series finale.
First-inning run production had been key for the Giants on their successful road trip entering Thursday. The club had scored during the first frame in the first six games of the trip while winning five of them. But on Thursday, it was the Cardinals' turn to make the first frame count.
Beltran connected on a 2-1 cutter from Bumgarner and hooked it just inside the left-field foul pole to put St. Louis up by two.
"That was pretty much what I wanted to throw there," said Bumgarner "I got it in there. I didn't think he'd keep it fair, but he did."
After the first inning, Bumgarner didn't allow another hit through the next four innings. In the sixth, Jon Jay led off with a double and stole third on the first pitch of the next at-bat. The speedy Jay slid in just ahead of Buster Posey's throw and scored on a sacrifice fly by Allen Craig.
Bumgarner allowed just three hits and one walk over six innings for his sixth straight quality start. The 23-year-old left-hander also struck out seven and has fanned at least seven batters in seven of his last eight outings.
"I felt good for the exception of really just one pitch that really hurt me," Bumgarner said. "That was pretty much it."
Against a Giants offense that had averaged more than nine runs per game in six games on their road trip entering Thursday, St. Louis starter Wainwright allowed just one run and five hits over seven innings.
"[Wainwright] doesn't miss his spot very often," Scutaro said. "He worked both sides of the plate very well. Sinker, cutter, curveball .. he just knows how to pitch."
Wainwright pitched out of few jams, including avoiding what could have been a breakthrough inning for the Giants in the fifth.
Scutaro -- who has hit safely in all but two of his past 13 games with the Giants -- had the bases loaded as Joaquin Arias and Bumgarner hit back-to-back singles followed by an Angel Pagan walk. Scutaro lofted a fly ball into right-center that Jay ran down for a sliding catch in the gap. A potential game-tying double was just a sacrifice fly.
"We were hoping Scutaro's ball would have gotten heavy there and drop in for us," said Giants manager Bruce Bochy. "That was a turning point in the game there. That ball falls in and we have something pretty good going there."
The Giants had a pair of scoring opportunities in the middle innings, but Wainwright closed the door both times. San Francisco had runners on first and third in the fourth, but Brandon Belt popped out to the end the inning.
Buster Posey singled to start the sixth -- extending his hitting streak to a season-high 13 games -- but was stranded on second as Wainwright got Arias to swing and miss on a 3-2 pitch with two down.
"That's kind of what I live for," Wainwright said of being a stopper. "If there's a challenge out there, not that you need more motivation, but it allows you to focus a little bit more."
Mitchell Boggs, who was roughed up for four runs in a third of an inning Wednesday night, shut down the Giants in order in the eighth. Jason Motte issued a two-out walk to Arias in the ninth, but got pinch-hitter Hector Sanchez swinging to end the game.
"That's a good team over there, too, and that's a team that's going to be right there in the end with their pitching staff and their lineup," said Boggs.
The Giants' loss capped a seven-game road trip in which they went 5-2 after dropping seven out of 10 on a previous homestand. They'll return home for six more beginning Friday.
Prior to heading out on the road, Bochy had said he hoped his club could turn things around after the sour homestand. While the trip ended on a loss, San Francisco increased the gap over Los Angeles for first place in the National League West and did what Bochy had asked for.
"We're getting to the latter part of the season. You try not to think about that ... standings and other teams," Bochy said. "You don't try. You can't. You've got to be concerned with what you do, and win ballgames.
"This was an important road trip. We bounced back after really struggling there at home. The guys showed a lot of character on this trip."
Mike Still is an associate reporter for MLB.com. This story was not subject to the approval of Major League Baseball or its clubs.