If a person commits any major sin while being overwhelmed with emotions, he should repent and mend his ways. It is essential that he repent as soon as possible. The Almighty has clearly stated in the Quran that He will forgive people who commit a sin while being overwhelmed with emotions if they repent right after it. He will not forgive people who sin all their lives and repent when they see death approaching. Similarly, He will not forgive people who deliberately reject the truth if they continue with this attitude till their death:
إِنَّمَا التَّوْبَةُ عَلَى اللّهِ لِلَّذِينَ يَعْمَلُونَ السُّوءَ بِجَهَالَةٍ ثُمَّ يَتُوبُونَ مِن قَرِيبٍ فَأُوْلَـئِكَ يَتُوبُ اللّهُ عَلَيْهِمْ وَكَانَ اللّهُ عَلِيماً حَكِيماً وَلَيْسَتِ التَّوْبَةُ لِلَّذِينَ يَعْمَلُونَ السَّيِّئَاتِ حَتَّى إِذَا حَضَرَ أَحَدَهُمُ الْمَوْتُ قَالَ إِنِّي تُبْتُ الآنَ وَلاَ الَّذِينَ يَمُوتُونَ وَهُمْ كُفَّارٌ أُوْلَـئِكَ أَعْتَدْنَا لَهُمْ عَذَابًا أَلِيمًا
It is incumbent upon God to forgive those who commit a sin while being overwhelmed with emotions and then quickly repent. It is they who are forgiven by God. God is all-knowing and wise. But He will not forgive those who sin all their lives and, when death comes to them, say: “Now I repent!” nor those who die as disbelievers. It is for these that We have prepared a grave punishment. (4:17-18)
In the above verses, the Quran has ascertained two cases in which repentance shall be accepted by the Almighty. After this, one case remains: a person was not able to repent right after his sin; however, he did not delay repentance till his death. In this case, the Quran is silent and in the words of Imam Amin Ahsan Islahi, this silence creates hope as well as fear and the purport of the Quran also seems that one should remain between hope and fear in this case. He says that in spite of this what comes to his mind is the fact that such people would hopefully attain salvation through the intercession of the Prophet (sws) because in their case there is no reason for it to be prohibited.
Secondly, the warning of eternal hell is for people (whether claiming to be a Muslim or Non-Muslim) committing rebellion against God (Istakbar/Sarkashi) for which it is mentioned in Quran that:
إِنَّ الَّذِينَ كَذَّبُواْ بِآيَاتِنَا وَاسْتَكْبَرُواْ عَنْهَا لاَ تُفَتَّحُ لَهُمْ أَبْوَابُ السَّمَاء وَلاَ يَدْخُلُونَ الْجَنَّةَ حَتَّى يَلِجَ الْجَمَلُ فِي سَمِّ الْخِيَاطِ وَكَذَلِكَ نَجْزِي الْمُجْرِمِينَ لَهُم مِّن جَهَنَّمَ مِهَادٌ وَمِن فَوْقِهِمْ غَوَاشٍ وَكَذَلِكَ نَجْزِي الظَّالِمِينَ
Indeed those who denied Our revelations and evaded them in arrogance, the gates of heavens shall not be opened for them and neither shall they be able to enter Paradise except if a camel is able to pass through the eye of a needle. [This is their punishment] and in this manner do We punish the criminals. Hell shall be their bedding and [the flames of] Hell shall be their covering and in this way do We punish the evil-doers. (7:40-41)
Therefore, a true muslim can never commit istakbar. If he commits sins, he will revert back to God and asks forgiveness which will ultimately result in his forgivenss, but if there is even iota of arrogance in one’s heart, then there is no forgiveness for such a person. So as long as a Muslim stayed away from a rebellious attitude, then chances are that He/She will eventually go to Jannah after Tazkiya, if required (as a result of his true eman).