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.
Caroline Berg Eriksen: Soccer player's wife triggers debate with post-birth selfie
18-year-old elf alleges mall Santa pinched her buttocks on the job