San Diego maintained a 2 1/2-game lead over San Francisco in the National League West and moved six games ahead of the third-place Dodgers.
Los Angeles owned a 1-0 lead through five innings, but the Padres scored twice in each of the next three to take control.
A sacrifice fly by Nick Hundley in the sixth put San Diego in front and Hairston had a part in each of the next two innings. He had an RBI double in the seventh and drove in both of the eighth-inning runs with a single.
San Diego, which has won four out of five, got six innings out of starter Clayton Richard (8-5). He gave up a run on four hits and struck out six.
Dodgers' starter Hiroki Kuroda (8-9) surrendered up the go-ahead run in the sixth and took the loss.