The baby was born out of wedlock you must petition the court and go through a legal proceeding to have the baby Declared your legal dependent. Getting married after the birth does not automatically make them your legal child in Thailand. A few steps & interviews but not too complicated.
I used an attorney to do mine takes months to get it done. Afterwards you can get a dependent visa. Pretty much same requirements and procedures as a marriage visa.
Married or dependent requires 400K in the bank or equivalent income. Either in thailand or abroad. You can combine multiple income streams for the income requirement but you cannot combine money in the bank with income as you can with a retirement visa.
Either way you need to get a new non O as stated above you can get a 90 day non O then get a 60 day family extension should be enough time to sort out a long stay visa. Marriage will be quicker than dependent.