The Liverpool man waited for Gueye, who drilled a low shot at goal which took a huge deflection off defender Cionek, wrong-footing Wojciech Szczesny and rolling into the net.
Niang added a second goal for Senegal on 61 minutes to keep the African side safe.