The result rounded off a bad week for Mauricio Pochettino's side after their Carabao Cup semifinal exit to Chelsea, and they missed a golden chance to get back into the match when Kieran Trippier blazed wide from the spot.
After a slow opening spell on a windy south London afternoon, Palace took the lead after nine minutes.
A VAR check for offside confirmed the goal was good and Palace soon threatened again when Wilfried Zaha found space but saw his driven cross cleared.
With 18 minutes gone, Spurs were close to a leveller when Lucas Moura lashed a fierce shot just over from an angle outside the area. But back came Palace, defender Patrick van Aanholt roaming forward to thump a long-range shot that was well handled by Gazzaniga.
The home side missed a chance to punish Spurs when, on a four against three break, Townsend overran the ball and allowed Oliver Skipp to intercept.
Kyle Walker-Peters, pushing forward down the left, delivered two crosses in quick succession but neither posed a serious threat to Palace.
But with 34 minutes gone, Walker-Peters' blatant handball as a Zaha cross headed for Wickham gave Palace the chance to double their advantage and Townsend smashed the penalty past Gazzaniga.
The Spurs keeper made a crucial save minutes later when Van Aanholt's low cross found Townsend free and Palace looked set to all but seal the win.
The Eagles almost conceded moments later when Lucas won a dangerous free kick and Trippier rolled the ball cleverly to Georges-Kevin N'Koudou, who was denied by Speroni's double save.
Speroni tipped Llorente's deflected effort around the post as Spurs stepped up their search for a route back into the game, before Sanchez was booked for fouling Townsend as Palace tried to break.
The home side were being forced back and Lamela blasted a free kick into the wall after Lucas was fouled before Foyth was booked for a clumsy challenge but Van Aanholt wasted the free kick.
Ward blocked Lamela's volley inside the area and then Trippier's bouncing volley across the box eluded Llorente as a breakthrough evaded Spurs.
Wickham made way for Christian Benteke as Roy Hodgson made his first change and the home side produced their best spell of the half, Zaha heavily involved but a telling final pass lacking.
Palace replaced Max Meyer with Luka Milivojevic and Kazaiah Sterling came on for Lucas for Spurs, and the Eagles almost put gloss on the scoreline as Zaha's low drive was held by Gazzaniga.
The home side brought off second goal-scorer Townsend, Jordan Ayew on in his place, as they ran down the clock to secure their place in the fifth round.