A goal in the closing stages of the game earned 10-man Gordon the honours in this Border Cup Battle.
Legion broke the deadlock when Alan Redpath turned the ball into his own net.
Redpath fixed his mistake in style by scoring at the right end to equalise, but Liam Lavery restored Legion’s lead with a left-footed drive.
However, the home side, who had been reduced to 10 men due to Brian Tait being sent off for making remarks towards the referee, equalised again through Kevin Utterson.
And five minutes from the end, Gordon’s Euan Brown headed home the winner.