Ok, I managed to fix it, here's what happened.
I had a table "TSO" and a table "SO" which referenced to TSO, I somehow managed to delete TSO without getting any constraint error (which I believe I should have, even though "SO" was empty).
After that any time I tried to insert the table with the name "TSO" I was getting that error, because the table "SO" still had reference to the now deleted table with the same name. After I deleted "SO" too I was finally able to insert TSO again.