Trailing 3-2 entering the sixth, Chris Denorfia lofted a sacrifice fly to produce a tie and Hairston followed by driving a pitch over the head of Marlins left fielder Logan Morrison, bringing home Will Venable and newly acquired Ryan Ludwick with the go-ahead runs.
Three Padres relievers made the lead hold up, but closer Heath Bell struggled in the ninth, allowing Florida to cut the lead to one run on Morrison's RBI single before closing it out for his 30th save.
San Diego starter Jon Garland (10-7) picked up the victory after allowing three runs in six innings as the first-place Padres avoided a three-game sweep at the hands of the Marlins.
Florida starter Josh Johnson (10-4) was touched for five runs on seven hits in 5 2/3 innings.
NBC reportedly holds celebs hostage to Jimmy Fallon's show
Kim Kardashian, Kanye West reportedly set wedding date