The Giants were in line to win their second straight series of the second half when Santiago Casilla entered the game in the ninth inning with a 7-5 lead.
With one swing of the ball, all bets were off. After walking Mark Trumbo to put men on first and second, Jonathan Schoop smashed a hanging breaking ball into the left field bleachers, giving the Orioles an 8-7 lead.
In the bottom half of the inning, the Giants couldn't respond Sunday at AT&T Park.
Hunter Pence blasted his first home run in 85 at-bats and four Giants had multi-hit games despite the loss.
One of the surprise hitters to record two hits was pitcher Johnny Cueto. Known more for his comical nature in the box than his hitting, Cueto went 2-for-3 with an RBI single.
On the mound, Cueto didn't disappoint. Cueto tossed 6.2 innings while allowing three earned runs and struck out four.
Pence hit his eighth home run of the season on a solo shot in the fourth inning. The right fielder finished the day 2-for-5 as he looks to catch fire in an injury-laden season.
Along with Pence and Cueto, Angel Pagan and Trevor Brown paved the way offensively for the Giants with two hits apiece.
With the loss, the Giants dropped to 66-51 on the year.