With the Chisox clinging to a 2-1 lead in the fifth, Dunn blasted a pitch from Bud Norris onto Eutaw Street outside Orioles Park with a man aboard, sealing the victory.
Dayan Viciedo and Alejandro De Aza each provided an RBI for Chicago, which avoided a four-game sweep.
Andre Rienzo (2-1) went 6 2/3 innings for the win, allowing one run on four hits with a pair of walks and four strikeouts.
Addison Reed wrapped up the triumph with his 37th save.
Norris (4-2) ended up allowing four runs on nine hits with a walk and six strikeouts in 4 1/3 innings for the Orioles, who temporarily fell 1 1/2 games behind Tampa Bay for the final American League wild card spot.
Adam Jones homered for Baltimore.