Juninho got control of the ball in the 91st minute and passed it to Cahill, who launched a close-range header on net that eluded Carlo Cudicini for the game's only goal.
The Red Bulls (7-4-3) held onto first place in the Eastern Conference with 24 points.
Robbie Keane had the best chance for Los Angeles (5-4-2), coming within inches of the net on a free kick just before halftime. He was denied by New York's Luis Robles on a fingertip save.
The loss was the third in four games for the Galaxy.
Millions of Getty images now available for free via embed tool
Ray Liotta sues skin care company over use of likeness