The masbuq did not perform sajda al-sahw with the imam
Question
Zayd caught two rak‘as of Maghrib. The imam did not sit in the second sitting (qa‘da) but stood up; on remembering, he sat down again. Then the imam performed sajda al-sahw (the prostration of forgetfulness) in the final sitting. Owing to some forgetfulness, Zayd could not join in the sajda al-sahw. After the imam gave the salam, Zayd completed the rak‘a. Then he remembered that the imam had performed sajda al-sahw; he too performed the prostration of forgetfulness and gave the salam in the last rak‘a.
Answer
This masbuq’s prayer is valid.
Source: Fatawa Mahmudiyya
Preview. The full text opens with JavaScript enabled.