It could be your stapes or your tensor tympani muscle going into spasm. I had a problem like this last year. Lasted 3 months. Some of the spasms lasted 9 hours. I worked out that was around 6000 seperate thuds. Impossible to sleep with. Now I havd regular clicking rather than thudding (although that comes and goes). No idea how long this will last. Have to heavily sedate myself to get sleep. Some say cyclobenzaprine helps though I haven't tried it. In extreme cases a surgeon can cut the muscles.