Pirates closer Joel Hanrahan (4-1) came in to start the ninth in a 2-2 tie game, but Hart blasted his second pitch into the Milwaukee bullpen beyond left field, lifting the Brewers to a walk-off victory.
Marco Estrada pitched seven innings of one-run ball, striking out 10, and John Axford (5-7) collected the victory with a scoreless top of the ninth.
Carlos Gomez also knocked in a run for Milwaukee, which clinched its three-game series.
A.J. Burnett struck out nine but walked four over 6 2/3 innings as the National League wild card-contending Pirates fell for the eighth time in 11 games.
Celebrity Breakups and divorces of 2014 [PHOTOS]