Red Bulls midfielder Juninho found a charging Cahill in the penalty box on a free kick and the Australian international went to his offensive staple - heading in the ball for the game winner in injury time.
The late winner broke apart a tight affair that appeared to be heading towards a scoreless draw between MLS's two marquee squads at Red Bull Arena.
In a star-studded match that featured Cahill, Landon Donovan, Robbie Keane and Thierry Henry, several role players stepped up to keep the match close on both sides.
Luis Robles had three saves including a stunning fingertip block on a pinpoint free kick from Keane in 41st minute. Although both teams had opportunities to go ahead, Sunday's match was a tight affair thanks to stellar defensive performances from each team's cast of center backs.
The Galaxy's A.J. DeLaGarza hit the ground to have a goal-line save on a close range shot from Fabian Espindola, similar to former New York defender Tim Ream's block on Landon Donovan two years ago. Jamison Olave held his own as well, limiting Keane to a primarily quiet afternoon aside from one chance late in the game.
In the 88th minute, Galaxy forward Gyasi Zardes charged up the right side of the pitch and found Keane in front of goal on a cross. The Republic of Ireland international missed a header just in front of goal.
Then Cahill showed him how it was done moments later.