Baltimore managed only five hits off Texas starter Colby Lewis (3-2), but all of them were home runs.
Flaherty, J.J. Hardy and Nick Markakis -- the first three batters in the first inning -- all hit the ball out of the park. The Orioles did not manage another hit until the seventh, when Adam Jones delivered a solo shot and Wilson Betemit had a two-run blast.
Baltimore won despite being outhit 10-5 and the Orioles had to survive a three-run homer in the ninth by David Murphy.
Murphy's blow came with one away, but after giving up the homer Jim Johnson retired the next two batters for his ninth save.
Wei-Yin Chin (3-0) allowed two runs on six hits over 7 1/3 innings to get the win.