It is narrated from Yusuf (may Allah have mercy on him) that he saw Mu'awiyah (may Allah be pleased with him) lead the people in prayer. He stood up after two rak'ahs (where he should have sat), so the people said "Subhan Allah," and he signalled to them to remain standing. Then, when he had finished his prayer, he performed two prostrations before the salam, and the people prostrated with him. Then he said: O people! I heard the Messenger of Allah (peace and blessings be upon him) say: "Whoever is overcome by doubt in his prayer, let him perform two prostrations while sitting."
Hadith Referenceالمعجم الكبير للطبراني / باب الميم / 16826