The O's found themselves down 5-0 after the first inning but responded with four runs of their own in the next frame, capped by J.J. Hardy's two-run, two-out double.
Then in the fourth, Nick Markakis and Hardy each drew two-out walks from Tigers starter Doug Fister (7-8) and McLouth followed by lining an 0-2 pitch into the right-center field gap, scoring both runners to put the O's ahead.
McLouth himself scored on Adam Jones' single and Baltimore went on to take the rubber match of a three-game series from American League wild card rival Detroit.
The rally made a winner of Wei-Yin Chen (12-7), who surrendered five runs on seven hits through five innings.
Jim Johnson nailed down his 37th save with a 1-2-3 ninth.
Fister ended up allowing seven runs on eight hits over 3 2/3 frames.
Jhonny Peralta smacked a three-run homer and Omar Infante added a solo shot in the first inning for the second-place Tigers, who came into the game 1 1/2 games game behind the American League Central-leading Chicago White Sox.
Notable deaths of 2014 [PHOTOS]