Brian Rice's side knew a victory would guarantee another year in the top flight and Ziggy Gordon and Steve Davies scored at the Hope CBD Stadium.
Cody Cooke grabbed a second-half hat-trick as St Mirren defeated relegated Dundee 3-2 at the Kilmac Stadium at Dens Park but it wasn't enough and Saints will now face Dundee United in the play-off final on Thursday and Sunday, with the first leg at Tannadice.
In the day's other bottom-six match, David Turnbull's double helped Motherwell beat Livingston 3-2 at Fir Park.