Sahih Muslim Book 7, Hadith Number 2998.

Chapter : Regarding one who shaves before offering the sacrifice or offers sacrifice before throwing (the stones at Jamra).

Abdullah b. Amr b. al-‘As (Allah be pleased with them) reported: As Allah’s Apostle. (may peace be upon him) was delivering sermon on the Day of Nahr, a man stood up before him and said: Messenger of Allah, I did not know that such and such (rite was to be performed) before such and such (rite). Then another man came and said: Messenger of Allah, I thought that such and such (rite) should precede such and such (rite), and then another man came and said: Messenger of Allah, I had thought that such and such was before such and such, and such and such (is the sequence) of the three (rites, viz. throwing of pebbles, sacrificing of animal and shaving of one’s head). He said to all these three: Do now (if you have not observed the sequence); there is no harm in it.