As a low-level spellcaster, what can be done to counter the deafness from a thunderstone? Either by protecting against deafness, circumventing or removing the effect.
Here are a few different ways to either protect yourself from a thunderstone or ignore its effects:
Earplugs - Grant a +2 bonus on your save against the thunderstone's effect, and are inexpensive enough for any low-level character.
Forced Quiet - This spell can we cast on someone to protect them against sonic effects, like those of a thunderstone. It grants them +2 on their save, stacking with earplugs.
Remove Blindness/Deafness - If you're already deafened, this 3rd level spell (cast by a friendly caster or from a scroll) will clear it without waiting out the full hour.
Spells without verbal components are not affected by being deaf, including the deafness induced by a thunderstone. If you expect to be deaf, you can use the Silent Spell metamagic to remove verbal components from your spells. Alternatively, the Deaf curse Oracle gets Silent spell for free on every spell they cast.
As Cellion suggests, if you're worried about this attack, you could wear earplugs. This item gives +2 to your save against sonic effects but -5 to hearing-based perception checks.
Other than that, for a low-level spellcaster, you shouldn't spend resources defending against this attack. This attack inflicts on you a 20% spell failure chance for an hour. If the combat lasts five rounds and then you can rest for an hour, then on average you will lose only one spell from being deafened, and you might not even lose that if you fail your save.
It's not worth it to prepare silent spells, to spend a spell slot on forced quiet as a precaution, or to use a third-level spell scroll on remove deafness. Just be glad that the enemy didn't do something more effective with their ranged attack.