However, Ayhan's far-post header from a free-kick with nine minutes to go left the two teams level on 19 points, with Iceland closing to within four points after their win over Andorra.
It was a laboured performance from the world champions, only lifted by Chelsea forward Giroud's third goal in four internationals, having scored the winner against Iceland on Friday.
But the celebrations for his 38th goal for France, three short of Michel Platini's record for the country, was short-lived when Ayhan struck.
France had 12 shots in the first half to their opponents' one and 64 per cent possession, but they found it hard to break down the visitors.
Things did not get any better for them after the break: 11 more shots, only three on target and, crucially, only one goal.
With Giroud on the bench Wissam Ben Yedder was given a run up front but that placed even more responsibility on Antoine Griezmann against a team beat France 2-0 in Konya in June – a win which keeps them top of the table because of having the better head-to-head record.
The Barcelona forward had a number of half-chances in the opening 45 minutes but failed to properly test Fehmi Mert Gunok, once shooting straight at the goalkeeper for Moussa Sissoko to blaze over the rebound and on another occasion curling a left-footed shot wide of the post.
Sissoko was also not without blame as he squandered chances and France became guilty of over-complicated play in and around the penalty area as the clocked ticked towards the hour mark.
They were almost hit with a sucker punch when a rare Turkey counter-attack saw Burak Yilmaz's half-volley fly over the crossbar from a good position.
Ben Yedder's frustrating night was ended in the 72nd minute when he was replaced by Giroud.
It took the 33-year-old less four minutes to make the difference, powering home an angled header from Griezmann's corner.
However, nine minutes from time Ayhan drifted in at the far post to nod in Hakan Calhanoglu's free-kick.