All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
Your good deeds are not invalidated, Allah willing. These thoughts are nothing but whispers, so we advise you to avoid them and not give any attention to them. A boy is not religiously responsible or accountable for religious assignments and his apostasy is not valid at all according to the view of many scholars.
This is if we assume that that expression has resulted in apostasy. Moreover, if a person who is accountable for religious assignments has apostatized and then he prays, then he is judged to be a Muslim according to the view of many scholars.
Allah Knows best.