Dumbarton secured their safety with a 3-2 win over Cowdenbeath, who must win their last game of the season to stand any chance of avoiding a relegation play-off.
Colin Cameron's side are one point behind Dunfermline, who boast a much better goal difference.
They took an early lead against the Sons but conceded three goals in nine first-half minutes.
Craig Moore scored in the 15th minute when he was put through by Kyle Miller and placed the ball past Stephen Grindlay.
Dumbarton almost levelled instantly but Andrew Graham's header was saved by Thomas Flynn.
The equaliser came 10 minutes before the break as Scott Agnew brilliantly lobbed the stranded Flynn from 30 yards out.
Four minutes later Flynn was beaten again as James Lister headed in from Mark Gilhaney's cross.
And the Sons made it 3-1 before half-time as Agnew scored from the penalty spot after Cameron had fouled Steven McDougall.
Cowdenbeath pulled a goal back with two minutes left as Miller headed in from close range but were unable to force a leveller.