Trailing 2-0 entering the frame, Chris Davis blasted a first-pitch homer off Tigers starter Randy Porcello, cutting the O's deficit to a run.
Chris Synder's grounder forced Hardy at third but pinch-runner Alexi Casilla moved up on the play came home with the decisive run when McLouth sent a liner up the middle.
Casilla added an RBI double in the next frame as the Orioles took the rubber match of a three-game series.
Porcello (2-3) surrendered three runs on six hits over six full frames for the Tigers, who held onto first place in the American League Central despite the loss.
Prince Fielder went 2-for-4 with a solo shot for Detroit.
2014: The Year in Music [PHOTOS]