The Hawks trailed by five points with just over a minute to go but Burgoyne and Brad Sewell kicked goals to carry the Hawks to a 15.12 (102) to 14.11 (95) win.
Hawthorn lead the ladder on percentage and can clinch the minor premiership with a home win over Melbourne next Friday.
The Swans finish off at Geelong the following day, but might struggle to stay in the top two.
Franklin, playing his first game after six weeks out, finished with 4.3 and played a pivotal part in Hawthorn's second-quarter revival.
The Swans outscored Hawthorn 27-1 in the first quarter and increased their lead to 38 points early in the second.
Sparked by three second-quarter goals to Franklin and two to Burgoyne, the Hawks piled on 38 straight points to level the score.
The Hawks trailed by five points at halftime and led by four at the final change.
Former Hawk Josh Kennedy and veteran Ryan O'Keefe each goaled late in the last term to twice give Sydney a five-point lead.
However, Franklin kicked his fourth and then Burgoyne his third as the Hawks hit the front with 70 seconds left.
Brad Sewell also goaled in the closing seconds to close out a remarkable game which underlined why both teams are premiership contenders.
Kennedy tallied 35 touches and O'Keefe 30 for Sydney, with O'Keefe, Adam Goodes, Shane Mumford and Sam Reid all goaling twice for the Swans.
Jordan Lewis accumulated 28 possessions for Hawthorn and Burgoyne 26.