Attacker Gueye ended a four-month injury nightmare when returning to action as a second-half substitute in the 3-0 Scottish Cup win at Elgin City.