At the end of almost every game, the San Francisco Giants keep talking about snapping out of a "funk." Or breaking a "skid." Or stopping a "slump."

Except ruts like this don't last for months.

That's called a season.

Matt Cain was in complete control until giving up a go-ahead, two-run homer to J.J. Hardy in the seventh inning, starting a rally that sent the Giants to a 10-2 loss to the Baltimore Orioles on Sunday.

"For all of us, there's a lot of pride involved," Giants manager Bruce Bochy said. "Today was really a pretty good game until the last two innings. I can tell you that group in there is probably struggling with this a little bit. We have set the bar pretty high here the last three years, and to go what we're going through is not a lot of fun."

The Giants, winners of two of the last three World Series, continued a summer-long slide from first to worst in the NL West by crumbling again late.

Hardy's 21st home run of the season gave the Orioles a 3-2 lead. Four players drove in a run in the eighth, and Adam Jones hit his 24th homer in the ninth — a three-run shot that sent most of the announced sellout crowd of 41,622 to the exits.

Brandon Belt and Hunter Pence each hit RBI doubles off Bud Norris in the first before Baltimore scored 10 unanswered runs.

"We scored two runs early and then it's like we sit around and wait," said Giants shortstop Brandon Crawford, who was 0 for 3 with a walk. "We just kind of sit on the two-run lead and think that's all we need. A lot of times with our pitchers it is, but we have to pile on when we can."

Matt Cain (7-8) retired 15 of the first 16 batters he faced. He struck out five and walked one in seven innings, allowing only an RBI single by Nate McLouth in the sixth before Hardy's homer carried over left fielder Jeff Francoeur and into the first row.

Troy Patton (2-0) tossed one scoreless inning of relief to help Baltimore to its fourth win in five games.

Norris gave up six hits, struck out two and walked two in five innings. He had won his first two starts since the Orioles acquired the right-hander from Houston on July 31.

Cain, long accustomed to receiving little run support, baffled Baltimore's batters most of the afternoon. He sent down the first eight he faced before Norris' comebacker bounced off his glove, knocked him down and trickled around for an infield single.

The Orioles couldn't crack Cain again until Brian Roberts tripled leading off the sixth. After pinch-hitter Henry Urrutia struck out, Nate McLouth singled to slice San Francisco's lead to 2-1.

A day after hitting his majors-leading 42nd home run, Chris Davis doubled off the 399-foot marker in center leading off the seventh. Two batters later, Hardy homered to left to put the Orioles ahead.

"We've always played well here. We've just hit a funky patch and we need to get out of it," Cain said.

Nick Markakis, Matt Wieters, Jones and Roberts all drove in a run in the eighth to put Baltimore up 7-2. Three of the runs were charged to lefty Jose Mijares, and the other to Sandy Rosario. And Jones sent a changeup from starter-turned-reliever Barry Zito over the wall in left in the ninth to put the Orioles up 10-2.

San Francisco's stagnant offense never put up a fight. The Orioles retired 17 of the final 19 batters for the Giants.

Buster Posey, the reigning NL MVP and batting champion, is hitless in his last four games and in a 2-for-19 skid. World Series MVP Pablo Sandoval, who turned 27 on Sunday, snapped a 0-for-20 skid when he singled in the sixth and also walked twice.

NOTES: Giants CF Angel Pagan is progressing well in Arizona from left hamstring surgery and could be ready to make a rehab start soon, Bochy said. The Giants hope Pagan can return around Sept. 1. ... Orioles INF Wilson Betemit (right knee) will begin a rehab assignment at Class A Frederick on Monday, while OF Lew Ford (sports hernia) will report to Double-A Bowie on Tuesday. ... The Orioles begin a three-game series at Arizona on Monday. The Giants are traveling to Washington on Monday to open a three-game set against the Nationals on Tuesday.