The word ṯamūd refers to an ancient civilisation, which is mentioned several times in the Qurʔān.
Like many place names, in Classical Arabic, ṯamūd is normally treated as a so called 'diptote'. Diptotes are a special class of nouns that lack nunation in the form without a definite article (which is not necessarily indefinite, Names are definite per definition even without the definite article, for example). Moreover, they do not distinguish between the accusative and the genitive which are only marked with -a. In the definite and and construct form diptotes declines along three cases.
nom. ṯamūdu acc./gen. ṯamūda; constr.nom. ṯamūdu constr.gen. ṯamūdi constr.acc. ṯamūda all spelled as ثمود <ṯmwd>.
Notice that the spelling of a definite-articleless diptote accusative is different from a triptote accusative, which is marked with a final ا <ʔ>, read as -an (and -ā in pause).
Interestingly, we find four instances of ṯamūd- in the Qurʔān, where the accusative is marked with a final ا <ʔ>.
Q11:68 كان لم يغنوا فيها الا ان ثمودا كفروا ربهم الا بعدا لثمود
kaʔan lam yaġbaw fī-hā ʔa-lā ʔinna ṯamūda kafarū rabba-hum ʔa-lā buʕdan li-ṯamūda
'As if they had never prospered therin. Unquestionably, Thamud denied their Lord; then, away with Thamud'
The spelling in this case is much better understood taking ṯamūd as a Triptote, rather than as a traditional diptote. The topicalising particle ʔinna (or at least, a particle that causes left-extraposition, which is very Latin-script normative term) takes the accusative case, while the preposition li- takes the genitive case. If we read ṯamūdan and ṯamūdin, we would exactly get this spelling. In this line, therefore, ṯamūd is clearly treated as a triptote rather than a diptote.
Q25:38 وعادا وثمودا واصحب الرس وقرونا بين ذلك كثيرا
wa-ʕādan wa-ṯamūda wa-ʔaṣḥāba (a)rrassi wa-qurūnan bayna ḏālika kaṯīran
'And [We destroyed] `Aad and Thamud and the companions of the well and many generations between them'
ṯamūd appears here in a string of indefinite accusative, and the reading ṯamūdan is once again suggested by the spelling.
Q29:38 وعادا وثمودا وقد تبين لكم من مسكنهم وزين لهم الشيطن اعملهم فصدهم عن السبيل وكانوا مستبصرين
wa-ʕādan wa-ṯamūda wa-qad tabayyana lakum min masākini-him wazayyana lahumu (a)š-šayṭānu ʔaʕmāla-hum fa-ṣadda-hum ʕani (a)ssabīli wa-kānū mastabṣirīna
'And [We destroyed] `Aad and Thamud, and it has become clear to you from their [ruined] dwellings. And Satan had made pleasing to them their deeds and averted them from the path, and they were endowed with perception.'
Same context as 25:38, so can be understood in the same way.
Q53:50-51 وانه اهلك عادا الاولى وثمودا فما ابقى
wa-ʔannahū ʔahlaka ʕādan al-ʔūlā, wa-ṯamūda fa-mā ʔabqā
'And that He destroyed the first [people of] `Aad || And Thamud -and He did not spare [them]'
Again, essentially the same context.
So so far this all looks like ṯamūd is indeed declined triptotically in the Qurʔān. What about attestations where ṯamūd is not spelled with a final Alif?
ʔilā takes the genitive, so if we assume ṯamūdin it has the expected spelling.
In the second part of construct phrase, and thus in the genitive, this spelling is the expected spelling for ṯamūdin.
Q17:59 wa-ʔātaynā ṯamūda (a)n-nāqata <wʔtynʔ ṯmwd ʔlnʔqḧ> 'And we gave Thamud the she-camel'
In this context the noun is expected to be in the accusative. The absence of an alif is unexpected if ṯamūd was a triptote.
Nominative position, the triptotic reading ṯamūdun would have the same spelling.
Q27:45 wa-la-qad ʔarsalnā ʔilā ṯamūda <wlqd ʔrslnʔ ʔly ṯmwd> 'And we had certainly sent to Thamud ...'
ʔilā ṯamūdin would be spelled the same.
Q38:13 wa-ṯamūdu <wṯmwd> 'And Thamud'
wa-ṯamūdun would be spelled the same.
wa/faʔammā ṯamūdun would be spelled the same.
Q51:43 wa-fī ṯamūda <wfy ṯmwd> 'and in Thamud'
fī governs the Genitive, ṯamūdin would be spelled like this.
Q69:4 wa-kaḏḏabat ṯamūdu wa-ʕādun bi-l-qāriʕati <kḏbt ṯmwd wʕʔd bʔlqʔrʕḧ> 'Thamud and `Aad denied the Striking Calamity'
Nominative position: ṯamūdun would be spelled the same.
Q89:9 wa-ṯamūda <wṯmwd> 'and in the cities and (in) Thamud'
bi as found in Q89:6, which this noun refers back to takes the genitive, tamūdin would be spelled the same.
To sum up, four out of five times that ṯamūd appears in the accusative, it is treated as a triptote. In all other cases an interpretation as a triptote or a diptote is equally likely. Considering this evidence, it seems to suggest that ṯamūd was originally a triptote in the language of the Qurʔān, and it was only reinterpreted as a diptote in the reading tradition later (Turns out I'm not the first to come up with this).
One might expected that in older Qurʔān codices we might find Q17:59 written with the 'expected' extra alif, but this is never the case. Not even in very early documents like DAM 01-27.1 (carbon dated to 606-649).
However, the other way around is attested, e.g. the Paris Qurʔān is lacking the alif in 11:68, but other early manuscripts like Or. 6814 Carbon dated to come from 680-798, simply have the alif. The Samarkand codex also has alif.
The Sanaa Palimpsest, which often deviates from the modern Cairo edition, does have the alif in 25:38 (11:68 is not available/not present).
While it requires more in-depth research, it seems that diptotic spellings are often present, but that in the older manuscript the triptotic spelling is common.
A conservative solution to the variation of diptosy versus triptosy of this noun would be to assume that the noun could be both diptotic and triptotic. However, the fact that many early documents simply retain the triptotic spelling, suggests to me that this is older. The letter that follows the graphically separate alif in Q17:59 is also a graphically separate alif. Is its absence in this environment perhaps simply the result of an haplography?
So what triggered the innovation in the reading tradition to read ṯamūd as a diptote while the orthography suggests it's a triptote? Perhaps this can be understood as the result of a 'correction'. In Classical Arabic grammar all masculine proper names that are not of the shape faʕl, fiʕl, fuʕl, faʕal or a participle/adjective are diptotic. ṯamūd is a quite marginal adjectival pattern, and perhaps this is the source of the confusion. Either the pattern wasn't conceived of as adjectival enough unlike faʕīl patterns, or simply its obvious non-adjectival meaning triggered it to be treated as a diptote.