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.
First of all, you should know that the scholars have abundantly elaborated on the story of Al-Gharaneeq and the most correct opinion is that it is not authentic. Indeed, Shaykh Al-Albaani had written a dissertation about it clarifying that it is false (unfounded). For more benefit, please refer to Fatwa 119716.
On the other hand, we have not come across any scholar who said that Chapter An-Najm [Quran 53] was revealed in the fifth year of the Prophet’s mission; rather, the scholars differed in opinion about this Chapter whether it was revealed in Makkah or Madeenah, or that most of it was revealed in Makkah. These statements were mentioned by Al-Qurtubi who considered the view that it was revealed in Makkah to be the preponderant opinion.
Besides, the scholars differed in opinion about the time of Al-Mi’raaj (Ascension of the Prophet ) and Ibn Hajar reported about ten different opinions in determining its time.
If we assume that Chapter An-Najm was revealed in the fifth year of the Prophet’s mission as you mentioned, and that Al-Mi’raaj took place after that time because it was one year prior to Hijrah (the Prophet's migration from Makkah to Medeenah) according to the most preponderant opinion, then there is no discrepancy in this also.
Indeed, the Chapter of the Quran was not revealed completely at once; rather, in case of some Chapters, most of the Chapter was revealed in Makkah while a part of it was revealed in Madeenah and vice versa. Also, a verse may be revealed to the Prophet and he would order (the Companions ) to put it at its proper place of the Chapter. Hence, it might be that Chapter An-Najm was revealed first, and when the Prophet ascended to the heavens, the verses about the Al-Mi’raaj were revealed, and then the Prophet ordered (the Companions ) to put them in their proper place in the Chapter; so the matter is very clear now, praise be to Allaah.
Allaah Knows best.