Collin Quaner's last-gasp strike earned 10-man Ipswich a morale-boosting 3-2 win over Leeds, who head into the play-offs in dire form.
Marcelo Bielsa's side go into the first game of a two-legged tie with Derby having thrown away automatic promotion after successive defeats to Wigan and Brentford were followed by a draw against Aston Villa and the latest setback in Suffolk.
It was only a fifth win of the season for the relegated Tractor Boys, with Flynn Downes and Andre Dozzell their other scorers.
Leeds had levelled twice through Mateusz Klich and Stuart Dallas, while Kemar Roofe missed a penalty which had been awarded following a professional foul on him by Luke Chambers, who was sent off.
Town midfielder Downes found himself with just goalkeeper Kiko Casilla to beat in the 19th minute following tidy link-up play with Quaner and Alan Judge, but his goal-bound effort was deflected for a corner.
In the 28th minute, Ipswich striker Quaner collected a slide-rule pass from Dozzell only to be fouled outside the area by Casilla. But from the resulting free-kick by Judge the home side took the lead through Downes after the ball fell to him in the six-yard box.
Just before half-time Klich equalised for the visitors when he slammed the ball past Bartosz Bialkowski at the near post after a pinpoint cross from full-back Luke Ayling.
However, Ipswich regained the lead with a superb strike two minutes into the second half. Neat one-two touches in midfield between Trevoh Chalobah and Quaner fed Dozzell and he fired home from just inside the penalty area.
Bialkowski got down quickly to save a shot from Pablo Hernandez on the hour and defender Pontus Jansson headed narrowly wide in the 69th minute following a corner as Leeds fought for an equaliser.
A great double save from the Ipswich goalkeeper from attempts by Klich and Hernandez kept the visitors at bay.
But they did draw level after 76 minutes following another fine cross by Ayling. He found Roofe whose shot hit the crossbar and bounced down, struck Dallas and the ball ended up in the net.
Leeds were then awarded a penalty in the 80th minute when Chambers was adjudged to have fouled Roofe.
The Ipswich captain was shown a straight red card as Roofe prepared to take the penalty but he fired high over the crossbar, much to the delight of the Ipswich fans.
Ipswich then won the game in bizarre fashion following a mix-up between Ayling and Casilla, with Quaner pouncing to fire the ball into an empty net.