The struggling Everton defence gifted Bolton Wanderers a vital away win, meaning Sam Allardyce's men are set to record their highest-ever finishing position in the Premier League.
Bolton arrived at Goodison Park seeking their fifth win in as many matches and a chance to bring European football to the Reebok Stadium next season.
Everton were hoping to restore some much needed confidence after a poor run of form saw them threatened with the prospect of first division football next season.
The home side's early dominance, which saw four shots in just three minutes, came swiftly to an end as the visitors were gifted an early free-kick.
England international Wayne Rooney brought down ex-Real Madrid man Ivan Campo, but the resulting shot was wasted by Henrik Pedersen, who hit the ball wide of Nigel Martyn's goal.
Wanderers then grabbed a deserved lead after dismal defending by Everton's Tony Hibbert saw French International Youri Djorkaeff score via the home side's right hand post.
Scottish defender David Weir received a yellow card after a 30th minute foul on Bolton's Nicky Hunt. He was later lucky to escape a sending off after a horrific second-half foul on Kevin Davies.
Despite being booed off at half-time and making two substitutions in the form of Tomasz Radzinski and Lee Carsley for Alessandro Pistone and Alex Nyarko, the Goodison outfit's performance early on in the second half was just as poor as the first.
However, Bolton's dominance was swiftly brought to an end when Radzinski struck a 20-yard effort which almost saw the Blues draw level. But the home side failed to score as the ball bounced off the right hand post.
Just minutes later Everton were gifted a second chance but youngster Leon Osman's strike sailed straight over the crossbar.
Seconds later Scottish International James McFadden was also denied a goal after some excellent defending from the Trotters' rearguard.
The home side eventually broke through, however, with a goal from captain Duncan Ferguson. An error by the away defence saw Osman break through to cross to Ferguson, who scored with a left-footed strike.
The home side should have then pulled ahead after sloppy defending by Wanderers left speedy Radzinski with an open goal to aim at. But the Canadian international failed to seize the opportunity, and the ball skimmed straight past the left hand post.
A controversial decision by referee Paul Durkin gave Everton a free-kick which was taken from the penalty spot.
Bolton's Emerson Thome was mistakenly judged to have passed back. Wayne Rooney drilled in a right-footed shot from the centre of the penalty area but the strike was expertly blocked by Ivan Campo.
Scottish international star McFadden was lucky to escape a yellow card on 72 minutes after knocking Hunt to the floor.
Hunt was then replaced by Anthony Barness after the fall aggravated his persistent left shoulder injury.
The resulting free-kick was taken right-footed by Jussi Jaaskelainen who passed to Per Frandsen. The Bolton star brought the ball right up the pitch and should have scored but his right-footed 25-yard shot sailed straight over Martyn's crossbar.
Carsley also found himself on the receiving end of a yellow card after 75 minutes after knocking over Campo.
The Toffees' dominance came to an abrupt end three minutes from time. Djorkaeff scored his second of the game - his fourth in two matches - and it was all over for Everton.
In a desperate attempt to snatch back a last minute draw, Everton manager David Moyes brought on striker Kevin Campbell to replace Weir, and played with four up front.
Leon Osman had three late attempts at goal in as many minutes, but missed each time, sending the ball wide of the right hand post.
Speaking of his disappointment after the match, Moyes said: "I don't think we deserved to lose the game but we certainly didn't do enough to win.
"We had a decent chance in the first five minutes of the game but then we fizzled out. Bolton got the goal and that was that.
"At least in the second half they were passing and thoughtful in their play.
"We managed to snatch a goal back but it wasn't enough.
"Now we've got to move on and get some pride back in order to build for next season." Wanderers' manager, Sam Allardyce is overjoyed with his team's success this season and vowed that it will continue.
He said: "Overall the first half was fantastic for us.
"In the second half Everton managed to get back into the game. The problem was our final finish was poor.
"We won today in the last five minutes to get a very precious three points. It also proves just how fit our players are.
"It's been a great season for us and we've finished with a great flurry of wins.
Now we hope to go one better making it six next week and allow us to build up the team for next season." Wanderers now seem to have put their Carling Cup final heartache behind them and have given themselves a great chance of bringing UEFA Cup football to the Reebok Stadium next season.
Man of the Match: Jay-Jay Okocha Youri Djorkaeff grabbed the headlines with both goals, but it was his Nigerian team-mate who pulled the strings in Bolton's midfield, using his full repertoire of tricks to bamboozle the Everton defence.