Lionard Pajoy also scored for the Union (6-9-2), who won their third in a row and fourth in five games.
The Impact registered an own goal in the 90th minute after a corner kick by Patrice Bernier eluded Philadelphia goalkeeper Zac MacMath.
Eight minutes earlier, Antoine Hoppenot sent a pass into the box, which was deflected toward Pajoy and he sent it past goalkeeper Donovan Ricketts in the 82nd minute.
Five minutes of stoppage time was added and Valdes didn't take long before scoring the game-winner on an assist by Sheanon Williams.
Following a 2-0 loss to Sporting Kansas City last Wednesday in the semifinals of the Lamar Hunt U.S. Open Cup, the Union came out sluggish for much of the game against the Impact.
But the speedy Hoppenot, a second-half substitute, ignited Philadelphia and helped secure the victory.
The Impact have lost four of five and fell to 6-12-3.