In standard English, the full sentence would be this:
'I might have thought of this closet'.
This is a common construction to refer to a possibility in the past:
(1) modal verb : might
(2) auxiliary verb: have
(3) past participle of main verb: thought
Similar construction are, for example 'I must have seen', 'I should have gone', 'I would have taken'.
In speech, the 'have' is usually contracted - ''I might've thought of this closet' - and in rapid speech it is often reduced to a simple schwa syllable /ə/, which sounds the same as 'a'.
If you think the 'a' as 'have', the grammar makes sense.