Two last-gasp goals helped Edinburgh University put ten points between themselves and bottom club Preston.
A first-half Jack Guthrie effort for the students required a smart save from John Gilbertson, and play switched from end to end after the break, but it took until the 90th minute for the opening goal to arrive.
Edinburgh’s Nathan Evans broke from right midfield, released Guthrie and his strong cross was driven home by David Oswald on 90 minutes.
Preston were stunned and their desperation showed as first striker Sean Martin was sent off on 91 minutes and then Chris Cairney saw red after a second caution on 92 minutes.
Edinburgh added a second goal when a powerful 20-yard effort from Stuart MacFarlane was deflected home.
Edinburgh Univ: Tufail, Thomson, Sutherland, Flett, Black, Jackson, Maelger, MacFarlane, Guthrie, Aitken, Patterson. Subs: Evans, Nikolaidis, Irvine, Oswald, Rawlinson, Hainey.
Preston Athletic: Gilbertson, Todd, Bruce, Gibson, Ramsay, Cairney, Scott, Devlin, Martin, Roy, Strachan. Subs: Stewart, Pennycuick, O’Hara, Thomson, Baillie, McIntyre, Aitchison.