(a) Ziyad bin Ilaqah (may Allah have mercy on him) narrates that Sayyiduna al-Mughirah (may Allah be pleased with him) led us in prayer and stood straight up after two rak'ahs. We said 'Subhan Allah' (Glory be to Allah), and he too said 'Subhan Allah' (Glory be to Allah) and carried on praying. When he had completed his prayer and given the salam, he performed the two prostrations of forgetfulness. Then he turned to us and said: This is how I saw the Messenger of Allah (peace and blessings be upon him) do it.
(b) Imam al-Bayhaqi (may Allah have mercy on him) said: The hadith of Sayyiduna Ibn Buhaynah (may Allah be pleased with him) is more authentic than this, and with it is the narration of Sayyiduna Mu'awiyah (may Allah be pleased with him); in their hadith, the Prophet (peace and blessings be upon him) performed the two prostrations before the salam. Wallahu a'lam (And Allah knows best).
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3824