It said everything about the outlandish denouement to this contest that Nemanja Matic, such an improbable matchwinner, was still wearing a look of shock and disbelief as he pinched himself through his post-match interviews. The Serb had not scored for Manchester United since his summer arrival from Chelsea, so few would have envisaged him plucking a frenzied game’s decisive fifth goal as the ball looped to him well outside the penalty area. Yet, with the match deep into stoppage time and fatigue gripping, it was time for one last swing.

Luka Milivojevic, the Crystal Palace captain, edged tentatively forward as if to block but turned his back as his compatriot connected. Matic’s connection was true, the ball arcing viciously to swerve away from Wayne Hennessey and the goalkeeper’s footwork was hesitant as if he had been taken by surprise. By the time the ball billowed his net, despairing team-mates were already sinking to their haunches as Matic wheeled away in celebration. United, a team who had trailed by two just before the hour mark here and would not be spared scathing criticism by José Mourinho, will go into Saturday’s game with Liverpool above their rivals and restored to the top two.

This ultimately appeared reward for United’s persistence but it owed much to the manager’s impact from the sidelines. There had been a rebuke at half-time for his players’ sloppiness in making “so many mistakes”, albeit that ear-bashing did not prevent the visitors shipping a “disgraceful, childish second goal” immediately after the break. As it transpired, necessity forced Mourinho to be bold in his substitutions and, with Marcus Rashford pinning back the impressive Aaron Wan-Bissaka, Juan Mata prompting centrally and Jesse Lingard filling in at right-back, they eventually forced their way back into the contest.

Chris Smalling had halved the deficit, nodding Antonio Valencia’s cross easily into the corner having been played onside by James Tomkins – how the hosts had craved maintaining that healthy advantage a while longer – with everything thereafter too frantic for Palace’s comfort. Roy Hodgson, his own bold gameplan rather swept away, would glance up to see “Rashford, Lukaku, Mata, Lingard, Sánchez and Luke Shaw flying forward” and a patched-up, depleted home side in retreat. Christian Benteke had already scrambled one Matic attempt from the goalline, but Palace would crack 14 minutes from time.

Sánchez’s shot looped up off Martin Kelly to bounce from the angle of post and bar, with Lukaku calmly gathering the rebound, patiently eking out space in a cluttered penalty area, and forcing a finish through the mess of bodies and beyond the unsighted Hennessey. A point would still have been cherished by Hodgson, a manager attempting to stave off relegation with an entire team of senior players currently crocked with ligament damage, broken bones or assorted strains, but Matic would wreck that prospect late on.

“I am very proud of the performance and can’t criticise any player for the effort they put in, their discipline tactically,” he offered through the numbness of defeat. “I just feel very sad for them all.”

Maybe the cold light of day will highlight the positives, for all that a trip now awaits on Saturday to Chelsea, the wounded defending champions. Palace had been aggressive and direct, encouraged by Benteke’s personal revival – the Belgian would draw a fine save from David de Gea immediately after United’s equaliser as he sought a first goal here since May – and Alexander Sørloth’s muscular running, Andros Townsend’s delivery and Wan-Bissaka’s enthusiasm and quality even up against Sánchez.

Townsend had earned them an early lead, his shot deflecting wickedly off Victor Lindelöf to loop beyond De Gea. Jeffrey Schlupp’s quick thinking at a free-kick, slipping Patrick van Aanholt free into enemy territory while Matic complained about the referee’s decision, earned them a second. Van Aanholt’s finish was crisply dispatched inside the goalkeeper’s near post.

The majority inside the arena could hardly contemplate such a healthy lead though, in truth, it actually served to spark United into life. The manner in which they flooded forward thereafter, encouraged by Smalling’s reward, and took their rewards boded well for their strength of character even if the sloppiness was still playing on the manager’s mind in the aftermath.

“A remarkable comeback, but we made mistakes. A fantastic comeback, but mistakes …” muttered Mourinho. “But the attitude, the intensity, the quality, the dynamic, the risk were fantastic. We needed that little bit of luck to win in the last minute but I’d say we deserved because the dominance in that last half-hour was huge.” At least all his criticisms could be issued in victory.

For Palace, Matic’s winner was the kind of sucker punch from which they may struggle to recover. Psychologically, at least. Harry Kane had scored from closer in, but only marginally earlier, in their previous home game, and they still loiter beneath the cut-off. Their destiny will boil down to how well they clear their treatment room and negotiate passage through a more appealing final six games. Yet shrugging off this disappointment will not be easy.