The Prophet ﷺ prayed three (rak'ahs) then said the taslim. Al-Khirbaq said: "You prayed three." So he led them in praying the remaining rak'ah, then he said the taslim, then he did the two prostrations of forgetfulness, then he said the taslim (again).
أَنَّ النَّبِيَّ ﷺ صَلَّى ثَلاَثًا ثُمَّ سَلَّمَ فَقَالَ الْخِرْبَاقُ إِنَّكَ صَلَّيْتَ ثَلاَثًا فَصَلَّى بِهِمُ الرَّكْعَةَ الْبَاقِيَةَ ثُمَّ سَلَّمَ ثُمَّ سَجَدَ سَجْدَتَىِ السَّهْوِ ثُمَّ سَلَّمَ