Goals from Ryan Brobbel, Curtis Edwards and Christian Burgess helped Boro extend their recent run to just one defeat in four games after a competitive encounter that saw both sides lead.
Palace, watched by new manager Ian Holloway, were unbeaten in three going into this one and they started well, with Connor Ripley in action to save from Matt Parson.
However it took just five minutes for Boro to edge in front as Matthew Waters pressurised goalkeeper Lewis Price who got in a bit of a tangle and inadvertently set up Ryan Brobbel, who was left with a simple task to score for the second successive game following his cracking strike against Manchester City recently.
Boro were grateful for the positional sense of Kyle Oliver when he cleared of the line from Kwesi Appiah, who a few minutes earlier was just off target with a cracking effort.
But Appiah's enterprise was rewarded with Palace's equaliser just 30 seconds into the second half when he smashed home off a post after his first effort had been blocked.
He missed a great chance to put the Eagles in front when he shot wide in a one-on-one with Ripley, before Boro broke only for Waters' shot to thud off a post after he latched onto a Jake Fowler delivery.
Palace went in front for the first time on the hour when Jason Banton dribbled along the goal line causing a problem in a Boro defence that didn't cope and he was left with time to register the third goal of the game.
Boro's response was good as Price kept busy with two long range efforts from Lewis Sirrell and another from Fowler, but it took a decent save from Ripley to deny Banton as the home side looked to close the game out.
Boro drew level seven minutes from time when Curtis Edwards curled an excellent free-kick over the Palace wall into the bottom corner.
Injury time was being played when Boro snatched the winner. This time defender Burgess was on target, heading home from a free-kick to ensure all three points at the Broadfield Stadium.
Clapham's side are next in action on Friday when they travel to Telford to take on Wolves.
Crystal Palace: Price; Taylor, Parsons, Martin, Gabbidon, O'Keefe (Daniel 62), Williams (Fenwick 30), Boateng, Sekajja, Appiah (Allassani 62), Banton. Unused subs: Fitzsimons, Wynter.
Middlesbrough: Ripley; Bennett, Weldon, Dolan (Capt), Burgess, Oliver, Fowler (Rivers 81), Brobbel (Jones 55), Waters (Edwards 70), Kneeshaw, Sirrell. Unused subs: Montgomery (gk); Morris.