Mevlüt Erdinç scored a stoppage-time winner for Fatih Karagümrük to inflict first league defeat on Galatasaray since October.
Ndao scored the opener for the home team in the 46th minute after the first half ended goallessly.
In the stoppage time, Diagne converted the penalty to give Galatasaray hope to salvage a point at Istanbul's Esenyurt Necmi Kadıoğlu stadium.
But Mevlüt Erdinç netted a late winner to seal 2-1 victory for his team ending Galatasaray's six leagues unbeaten game run.
Fatih Karagümrük was reduced to 10 men while their center-back Enzo Roco was shown a red card in the stoppage time.
Galatasaray manager Fatih Terim was also forced to leave the field as he received a red card in the 69th minute.
Lions defender Marcao was also shown a red card after the final whistle.