Elgin substitute Fraser Bremner scored with his first touch to steal the three points and put a huge dent in Fife's promotion bid.
Elgin almost caught the home side out after just four minutes with a short corner, but Martin Johnson's header thumped into the ground and just wide.
Joe Savage, a new signing from Stenhousemuir, was close to a debut goal for East Fife after 14 minutes, but sent a volley against the post. Scottish schools' captain Stephen Fortune then raced on to a Gavin Beith flip, but the teenage Fifer hit his shot straight at Kieron Renton.
City were causing problems in the air, and Paul Kaczan should have done better then send a free header over the top aftern 42 minutes.
East Fife threatened just before the break when Savage was hauled down and Gary Kelly's free-kick flew through the wall and into the keeper's arms.
Kevin Bain then saved East Fife when he stuck out a leg to prevent substitute Chris Gardiner netting a certain goal after 54 minutes.
Savage had a head cleared off the line, but it was Elgin who netted in the 64th minute with a wonder strike. Johnson's clever flick bounced kindly in front of Adam Nelson, and he lashed the ball across the keeper and into the corner.
Renton then kept his team ahead when he pulled off a wonder save to push John Martin's drive over the bar
Substitute Bremner then took the field after 81 minutes, and when East Fife failed to clear a cross he lashed the ball in off the underside of the bar.
With just seconds remaining, Hugh Dickson's slip allowed Martin to net a consolation goal for East Fife.