@William *******
, you were right! I sent an email to the Thai embassy in London to ask about this issue which I should have done at the first place. Their answer was exactly like what you explained earlier. The O-A visa is issued from the Thai embassy abroad. You have to leave Thailand to get a Non-O visa in order to apply for marriage visa at the immigration after you are in the country.