Middlesbrough secured their Sky Bet Championship status with a 2-1 win at Sheffield Wednesday, whose fate hinges on the outcome of an English Football League charge for breaking Financial Fair Play rules.
Boro boss Neil Warnock, the former Sheffield United manager, completed his mission at the home of a side he has a long history with as Britt Assombalonga's injury-time goal won it.
It was heading for a draw after Paddy McNair's leveller for Boro cancelled out Jacob Murphy's early opener for Wednesday, but Assombalonga won it at the death.
The job was all but done anyway – with an unlikely set of results needed to send Boro down – and the 71-year-old Warnock, who will now discuss his future with the club's hierarchy after guiding them to 18th position.
Wednesday finish 17th but they do not know which division they will be in as they are awaiting the verdict of their charge, which was issued way back in November, and if it is guilty they could be handed a points deduction.
The Owls are nine points above Wigan – pending the Latics' appeal against their own 12-point deduction – meaning they are vulnerable to the drop into League One if any penalty was imposed this season.
This was a fitting end to a miserable home campaign, with just one win at home in 2020.
Warnock loves coming to Hillsborough and he was almost celebrating an early goal as McNair shifted the ball across goal and then rattled the post from the edge of the area.
Three minutes later Boro were further cursing their luck as they fell behind because of the cruellest of deflections.
Murphy was allowed too much space and his 25-yard shot hit a Boro defender and completely wrong-footed Dejan Stojanovic.
Boro's response was impressive and they created two fine chances to quickly equalise.
First Ashley Fletcher shot straight at Joe Wildsmith following a mix-up in the Wednesday box and then the Owls goalkeeper made an impressive save to deny George Saville after a surging run into the box.
The leveller eventually came midway through the first half and it was McNair who found the scoresheet as Marcus Tavernier did well down the left and perfectly cut back to the midfielder to slot into the bottom corner.
Wednesday, in need of all the points they could get to improve their buffer, were the better team after the break.
They were nearly gifted an own-goal after Dael Fry put a defensive header from Barry Bannan's cross excruciatingly wide of the post before two late chances should have seen them win the game.
First Murphy rolled an effort just wide after great work from Dominic Iorfa on the left and then Connor Wickham had a shot blocked after a great turn in the box.
But they were killed at the end by a Boro counter-attack, with Assombalonga's turn and shot too hot for Wildsmith to handle with the ball spinning in.