The Orioles trailed by two heading into the sixth inning, then broke loose against Matt Cain and three relievers.
Nate McLouth singled in a run in the sixth to bring Baltimore within one and Hardy then put the Orioles in front with a two-run homer in the seventh.
Baltimore added four runs in the eighth, with a double by Jones bringing one of them home, and Jones finished things by clubbing a three-run homer in the ninth.
The comeback gave the win to Troy Patton (2-0), who worked the seventh inning.
Cain (7-8) gave up the lead after a strong start and was charged with the loss. He gave up three runs on five hits in seven innings. San Francisco has lost six of its last nine.
Astronomers offer more expansive view of universe
LGBT community has 'bullied the American people': Bachmann