Livingston returned to winning ways as they edged victory against Hamilton to clinch a top-six spot in the Scottish Premiership.
Livi striker Jay Emmanuel-Thomas' magnificent strike on the turn in the 16th minute was cancelled out by Callum Smith's equally-impressive drive on the half-hour mark.
Lions midfielder Scott Pittman restored the home side's lead with a poacher's goal in the 36th minute and – after a second-half that was more grit and graft than excitement – it proved to be the crucial winner in a 2-1 victory.
It was fifth-placed Livingston's first win in seven matches and with one pre-split fixture remaining they moved six points ahead of seventh-placed St Johnstone and will finish the season in the top half.
Hamilton remain one point ahead of bottom side Kilmarnock with six fixtures remaining, five after the split and their battle for survival goes on.
On a windy West Lothian afternoon, Livi manager David Martindale rang the changes with Jackson Longridge, Alan Forrest, Pittman, Jason Holt and Emmanuel-Thomas coming in.
Hamilton loan striker Bruce Anderson, unable to play against parent club Aberdeen last week, was reinstated.
Kyle Munro and Smith were also back in the side which played its part in a hard-fought first half which took off in the 16th minute when the home side took the lead.
As the hosts crowded around the Hamilton box, Livingston right-back Nicky Devlin played the ball into the feet of Emmanuel-Thomas and 30-year-old former Ipswich, Bristol City and QPR forward flicked it up, spun and – from 14 yards – fired a volley past Accies goalkeeper Ryan Fulton into the top corner.
However, his good work was undone on the half-hour mark when he was caught in possession in his own half and when the loose ball fell to Smith, he took a touch and rifled the ball from 30 yards low past Livi keeper Robby McCrorie for his second goal of the season.
The home side were soon ahead again, however, when the tireless Devlin's cut back from the byline inadvertently came off the chest of Hamilton full-back Lee Hodson and Pittman was on hand to bundle the ball over the line from close range.
The visitors tried to impose themselves on the game after the break but Livingston were proving resolute and durable and slowly began to threaten again themselves.
In the 75th minute Emmanuel-Thomas headed a Holt free-kick into the hands of Fulton, at least recording an effort on goal.
Moments later Accies' Ross Callachan latched on to a pass from fellow midfielder Scott Martin and squared the ball across goal past McCrorie but found no takers.
Three minutes from time, Livingston substitute Josh Mullin crashed a shot from distance against the crossbar with Fulton beaten but it became academic when the final whistle confirmed the home side's top-half finish.
Hamilton can never be accused of lacking spirit but still have lots to do to ensure safety.