Los Angeles bounced back from a setback on Wednesday that ended a four-game winning streak and the Dodgers improved to 28-7 since June 21. Their lead over Arizona at the top of the National League West increased to 3 1/2 games.
Chicago had a 3-2 lead heading into the sixth, but Scott Van Slyke singled to open the inning, Mark Ellis walked and both runners moved up on a sacrifice by Tim Federowicz.
Hairston then came on as a pinch-hitter for pitcher Ricky Nolasco and singled off starter Chris Rusin (1-1) to bring in the tying and go-ahead runs. Hairston eventually scored the third run of the inning on a base hit by Adrian Gonzalez.
Yasiel Puig added a homer for the Dodgers in the ninth and they overcame two solo shots by Chicago's Anthony Rizzo, his 16th and 17th of the season.
Nolasco (7-9) survived five innings to get the win, allowing three runs on four hits. Kenley Jansen struck out the side in the ninth for his 15th save.