Two goals in the final four minutes ensured Kilmarnock finished seventh in the Scottish Premier League thanks to a win over Dunfermline Athletic.
Relegated Pars were worthy of their first-half lead courtesy of Paul Willis' close-range finish following a Steven McDougall cut-back.
Kilmarnock dominated after the break and Liam Kelly smashed the ball high into the net for the equaliser.
Jude Winchester then fired the winner with a minute remaining.
And the defeat meant that Dunfermline leave the top flight with only one home win over the course of the whole season.
Buchanan and Willis celebrate after the latter opens the scoring at East End Park
Bernardo Dominguez Fernandez had been handed his debut in Dunfermline's goal after arriving from Huesca in January.
He was one of seven changes made by Jim Jefferies as the manager prepared for life back in Division One by dispensing with most of the old guard as well as on-loan Rangers midfielder Kyle Hutton.
However, the defensive frailties that have bedevilled the side all season emerged again as Kilmarnock started the better of the two sides.
As Alex Keddie hesitated, Jordan McMillan's hasty attempt to clear struck Gary Harkins and slipped just wide of a Pars post.
Ross Barbour was making his first start for Kilmarnock along with goalkeeper Kyle Letheren, with injury-plagued Ryan O'Leary being handed a rare place in the first XI, in place of Cammy Bell, Chris Johnston and Mo Sissoko.
The young defender looked to be posted missing as McDougall, who was one of the fresh starters for the Pars along with Willis, set up the opening goal.
McDougall headed a Joe Cardle free-kick back across goal for winger Willis to fire his first goal of the season from close range.
The visitors looked more determined after the break and a low drive from William Gros forced Fernandez into a good save with his right boot.
Barbour ought to have done better than head wide from seven yards and Andy Dowie did well to clear from in front of his own goal after Gary Harkins lofted an effort over Fernandez.
Dunfermline appeared to have survived the onslaught, but Kelly pounced to fire into the roof of the net from just inside the box for his first goal of the season.
The Pars thought they equalised seconds later, but Martin Hardie was ruled offside as he knocked the ball home from close range when he perhaps should have allowed fellow substitute Andy Kirk's header cross the line.
Dunfermline paid for that moments later when Lewis Toshney cut the ball back from the bye-line for sub Winchester to fire in the winner.
Full Time The referee blows his whistle to end the game.
James Dayton produces a right-footed shot from inside the area that clears the crossbar.
James Dayton takes a short corner.
Booking Jude Winchester is cautioned by the ref for leaving the field of play without the referee's permission.
The assist for the goal came from Lewis Toshney.
88:17 Goal scored
Goal - Jude Winchester - Dunf'mline 1 - 2 Kilmarnock Jude Winchester finds the net with a goal from close range low into the middle of the goal. Dunfermline 1-2 Kilmarnock.
The referee blows for offside. Kyle Letheren takes the indirect free kick.
The assist for the goal came from Dean Shiels.
85:10 Goal scored
Goal - Liam Kelly - Dunf'mline 1 - 1 Kilmarnock Liam Kelly fires in a goal from just outside the box to the top left corner of the goal. Dunfermline 1-1 Kilmarnock.
The offside flag is raised against Martin Hardie. Kyle Letheren restarts play with the free kick.
Free kick awarded for a foul by James Fowler on Ryan Thomson. Free kick taken by Andy Dowie.
Inswinging corner taken left-footed by James Dayton from the right by-line, save by Bernardo Fernandez.
Corner taken short by Dean Shiels.
Short corner taken by Liam Kelly.
Martin Hardie challenges Liam Kelly unfairly and gives away a free kick. Direct free kick taken by Liam Kelly.
Paul Willis takes a shot. Kyle Letheren makes a save.
Free kick awarded for a foul by Alex Keddie on Dean Shiels. Dean Shiels takes the free kick.
Substitution James Dayton replaces Gary Harkins.
Martin Hardie gives away a free kick for an unfair challenge on Liam Kelly. Liam Kelly restarts play with the free kick.
Martin Hardie fouled by Ryan O'Leary, the ref awards a free kick. Patrick Boyle takes the free kick.
Substitution Martin Hardie comes on in place of Liam Buchanan.
Substitution William Gros leaves the field to be replaced by Chris Johnston.
Patrick Boyle fouled by Gary Harkins, the ref awards a free kick. Patrick Boyle restarts play with the free kick.
Michael Nelson gives away a free kick for an unfair challenge on Liam Buchanan. Free kick taken by Andy Dowie.
Substitution Steven McDougall goes off and Andy Kirk comes on.
Substitution David Graham comes on in place of Joe Cardle.
Inswinging corner taken right-footed by Dean Shiels from the left by-line, Effort from the edge of the box by Liam Kelly goes wide of the left-hand post.
Gary Harkins takes a shot. Comfortable save by Bernardo Fernandez.
William Gros has a headed effort at goal from deep inside the area missing to the right of the target.
Corner taken right-footed by Dean Shiels, clearance made by Mark Kerr.
Lewis Toshney has an effort at goal from 35+ yards. Bernardo Fernandez makes a save.
Header on goal by Gary Harkins from inside the box goes harmlessly over the target.
Substitution Jude Winchester is brought on as a substitute for Ross Barbour.
Effort on goal by Dean Shiels from inside the box misses to the right of the target.
Liam Buchanan has a volleyed shot. Kyle Letheren makes a comfortable save.
Gary Harkins takes a shot. Save made by Bernardo Fernandez.
Dean Shiels takes a outswinging corner to the near post.
Corner taken right-footed by Dean Shiels, save by Bernardo Fernandez.
Effort on goal by Gary Harkins from 18 yards. Andy Dowie makes a clearance.
Mark Kerr gives away a free kick for an unfair challenge on Liam Kelly. The ball is swung over by Dean Shiels, Ross Barbour has a headed effort at goal from deep inside the area missing to the left of the target.
William Gros takes a shot. Save made by Bernardo Fernandez.
The referee gets the second half underway.
45:00 +0:03 Half time
Half Time The match has reached half-time.
Direct free kick taken by Liam Kelly.
Booking Booking for Ryan Thomson.
Dean Shiels fouled by Ryan Thomson, the ref awards a free kick.
Free kick awarded for an unfair challenge on James Fowler by Joe Cardle. Lewis Toshney takes the direct free kick.
Dean Shiels has an effort at goal from 20 yards. Save by Bernardo Fernandez.
Liam Kelly takes a shot. Save made by Bernardo Fernandez.
Unfair challenge on William Gros by Alex Keddie results in a free kick. Direct free kick taken by James Fowler.
Joe Cardle takes a outswinging corner from the right by-line to the near post, clearance by Liam Kelly.
Liam Buchanan takes a shot. Lewis Toshney gets a block in.
Shot from long distance by Ross Barbour goes wide of the left-hand upright.
The assistant referee signals for offside against Liam Buchanan. Kyle Letheren restarts play with the free kick.
Unfair challenge on Ryan Thomson by James Fowler results in a free kick. Bernardo Fernandez takes the direct free kick.
Unfair challenge on Gary Harkins by Jordan McMillan results in a free kick. Direct free kick taken by Ben Gordon.
Liam Kelly produces a right-footed shot from just outside the box that goes wide left of the goal.
Outswinging corner taken right-footed by Dean Shiels from the right by-line, clearance by Jordan McMillan.
Corner taken by Dean Shiels played to the near post, clearance by Steven McDougall.
Steven McDougall produces a left-footed shot from the edge of the area and misses to the left of the target.
The assistant referee signals for offside against William Gros. Bernardo Fernandez restarts play with the free kick.
The official flags Ryan Thomson offside. Kyle Letheren takes the free kick.
Ryan Thomson concedes a free kick for a foul on Liam Kelly. Liam Kelly takes the free kick.
Free kick awarded for a foul by Dean Shiels on Mark Kerr. Bernardo Fernandez restarts play with the free kick.
Free kick awarded for a foul by Gary Harkins on Jordan McMillan. Andy Dowie takes the free kick.
Headed effort from deep inside the penalty area by Gary Harkins goes harmlessly over the crossbar.
The assist for the goal came from Liam Buchanan.
19:04 Goal scored
Goal - Paul Willis - Dunf'mline 1 - 0 Kilmarnock Paul Willis finds the net with a goal from inside the six-yard box to the top right corner of the goal. Dunfermline 1-0 Kilmarnock.
Unfair challenge on Steven McDougall by Dean Shiels results in a free kick. Joe Cardle restarts play with the free kick.
Foul by Alex Keddie on Dean Shiels, free kick awarded. Free kick taken by Dean Shiels.
Ryan Thomson challenges William Gros unfairly and gives away a free kick. Direct free kick taken by Ryan O'Leary.
Inswinging corner taken right-footed by Joe Cardle from the left by-line, save made by Kyle Letheren.
Liam Kelly gives away a free kick for an unfair challenge on Ryan Thomson. Andy Dowie takes the direct free kick. Steven McDougall is flagged offside by the assistant referee. Kyle Letheren restarts play with the free kick.
Shot from just outside the penalty box by James Fowler misses to the left of the target.
The match begins.
Live text and data provided by The Press Association
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.