وَٱلَّذِينَ كَذَّبُوا۟ بِـَٔايَٰتِنَا صُمٌّ وَبُكْمٌ فِى ٱلظُّلُمَٰتِ … قُلْ أَرَءَيْتَكُمْ إِنْ أَتَىٰكُمْ عَذَابُ ٱللَّهِ أَوْ أَتَتْكُمُ ٱلسَّاعَةُ أَغَيْرَ ٱللَّهِ تَدْعُونَ
"Those who cry lies to Our signs are deaf and dumb, in darknesses… Say: 'If God's punishment came upon you, or the Hour came upon you, would you call upon any other than God?'"
بَلْ إِيَّاهُ تَدْعُونَ فَيَكْشِفُ مَا تَدْعُونَ إِلَيْهِ إِن شَآءَ وَتَنسَوْنَ مَا تُشْرِكُونَ (41) — "no, it is Him alone you call upon; and if He wills He removes what you called upon Him about, and you forget what you associate with Him."
This is one link in the line of "sincerity in danger" treated in many places in the index: al-ʿAnkabūt 29/65, Luqmān 31/32, Yūnus 10/22-23. I rely on that treatment.
What al-Anʿām adds must be recorded: in the others the scene was set at sea; here the kind of danger is not specified (ʿadhāb Allāh or al-sāʿa) — and the verb comes in the imperfect, that is, as a behaviour that is ongoing.
Wa tansawna mā tushrikūn — "and you forget what you associate with Him." I record this as an observation: the verse speaks not of abandoning but of forgetting — that is, it is not even a conscious renunciation.