Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) narrates: The Prophet (peace and blessings be upon him) said: "Whoever forgets to wipe his head (while performing ablution) and remembers it while he is praying, then if he finds moisture in his beard, let him take that moisture and wipe his head with it; that will suffice him. And if he does not find moisture, let him repeat the ablution and the prayer."
Al-Tabarani recorded it in al-Mu'jam al-Awsat; its chain contains a narrator, Nahshal bin Sa'id, who is a kadhdhab (liar).
Hadith Referenceمجمع الزوائد ومنبع الفوائد / كتاب الطهارة / 1234