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 is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
Our answer to your question will be summarized in the following:
1) First of all, it should be mentioned that many scientific theories do not reach the level of scientific facts. In fact many matters have been stated as scientific facts by the astronauts, but later they would withdraw their statements and say that these are only theories. Therefore, it is not possible to refer to theories which are subject to deficiency to argue the soundness of the Book of Allaah. The Quran is the Word of the Creator of this universe.
2) If there is anything in the Quran which appears to contradict a definite scientific fact, then the deficiency is either in confirming the scientific fact, or that it is in properly understanding what the Quran meant. A confirmed scientific fact can never contradict what the Creator of the heavens and the Earth said.
3) The interpreters of the Quran did not all agree that the meaning of 'flaming fire' refers to a star; rather some of them interpreted it to mean a flame of fire. For instance Al-Baydhaawi interpreted the verse in which Allaah Says (what means): {…and is pursued by a clear burning flame}[Quran 15:18], saying that '"burning flame" means a shining flaming fire, and it could refer to a star, or a spearhead, because of its shining.'
4) The word 'Star' in Arabic refers to many things: for instance, they call 'a planet' a 'star'. Ibn Manthoor said: 'The Arabs call 'a star' anything which goes up and raises (like planets).’ Therefore, it is not necessary to understand the statements of the interpreters of the Quran who said that 'flaming fire' refers to a star, by the astronomical definition of a star. That is why Ash-Shawkaani interpreted the saying of Allaah (what means): {…and is pursued by a clear burning flame} by a star which passed by, and that the stars which project are not among the fixed stars [which appear to be constant to another star or to someone who sees it] but among the stars which are not fixed.
5) If we presume that the meaning of 'flaming fire' is a star which is not fixed, then the fact that the stars are shooting the devils, does not necessarily mean that they move "out of the blue", as the questioner understood. Indeed it is confirmed in the Quran that stars descend, Allaah Says (what means): {By the star when it descends,…}[Quran 53:1]. Adh-Dhahhaak interpreted this verse by saying 'When Allaah shoots the devils with it.'
Allaah Knows best.