SAN JOSE, Calif. (AP) — Conor Casey scored two late goals on headers and the Philadelphia Union rallied to beat San Jose 2-1 on Saturday night, ending the Earthquakes’ winning streak at four games.

Casey entered as a substitute in the 60th minute and tied it in the 74th, finishing Raymon Gaddis’ diagonal cross with a leaping header. The goal snapped San Jose’s 447-minute shutout streak, the longest in MLS this season.

READ MORE: 5 People Shot Near Temple University, Philadelphia Police Say

The Union (8-14-6) took the lead in the 86th minute when Casey redirected Tranquillo Barnetta’s free kick with a glancing header.

READ MORE: EXCLUSIVE: Teenage Pilot Who Landed Plane On Bridge In Ocean City Shares How He Survived New Mexico Plane Crash

Chris Wondolowski converted from the spot to open the scoring for the Quakes (11-11-5) in the 64th minute. With a victory, San Jose would have moved ahead of Sporting Kansas City and the Portland Timbers into a fourth-place tie with FC Dallas in the Western Conference.

The Quakes’ Victor Bernardez left the game in the 39th minute with an apparent hamstring injury.

MORE NEWS: Gas Prices Expected To Keep Rising In Philly Area As Busy Summer Travel Season Approaches: 'We're Not Seeing Relief In Sight'

(Copyright 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.)