All perfect praise be to Allaah, the Lord of the worlds. I testify that there is none worthy of worship except Allaah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
There is nothing wrong with performing Tawaaf al-Ifadhah, Sa‘y, and shaving the hair before throwing Jamrat Al-‘Aqabah. However, it was better for you to throw Jamrat Al-‘Aqabah after zawal (beginning of the time of noon when the sun passes the meridian) of the 'Eid Day, which is the first of the Days of Tashreeq. According to a group of the scholars, if the sun sets before a pilgrim has thrown Jamrat Al-‘Aqabah, then he should not do that at night; rather, they should throw on the next day. According to others, however, it is permissible to throw at night.
We are of the opinion that there is nothing wrong with what you have done, especially at that time, when Hajj has become very crowded. The permissibility of throwing Jamrat Al-‘Aqabah at night, after the sunset of the 'Eid Day is the opinion of the Hanafi and Shaafi‘i scholars . It is also one of the two narrations that was reported from Maalik in this regard. This is based on the Hadeeth that was narrated on the authority of Ibn ‘Abbaas which says that the Prophet, sallallaahu ‘alayhi wa sallam, was asked about throwing the pebbles at night and said that it was permissible. [Al-Bukhari]
Allaah Knows best.