Varies between immigrations, some allows you to apply within the last 45 days, most within the last 30 days, but some only within the last week. The extension will always be added to your last day anyway. You can apply where you are at date and your latest TM.30 address registration is registered.
Check with the Thai embassy in Stockholm, but the only actual visa who will cover your whole stay is a one year Non O-A visa. The requirements are minimum 50 years old, income minimum 20,500 sek a month, an approved health insurance covering min 100K USD, health certificate and a police check up.
This is rarely checked at the immigration, but you might risk that your airline will ask for it at check-in in Sweden as they’re responsible for that passengers fulfils formal requirements for entering Thailand. You could call your airline and ask for their policy regarding this, but the best and safest would be to plan and purchase the ticket before you leave. Personally I would not have gambled with this as you never know and some airlines are quite strict regarding this now, as you as an example see on Finnair’s website.
You can enter on a 60 days visa exemption and do a 30 days extension at your local immigration, leave and re-enter on another 60 days visa exemption.
Be aware that’s it’s a formal requirement for visa exemption that you’re able to show proof of an onward ticket within 60 days even though you plan to apply for an extension later. Also when you re-enter Thailand.
So if you use visa exemptions for this stay, the best might be to buy a ticket out of Thailand within 60 days before you leave. Spend a couple of days in a nearby country and re-enter on another visa exemption with your return ticket back to Europe.
If you want to cover your whole stay with a visa you could apply for a six months multiple entries tourist visa before you leave, but you’ll still need a trip out. The one year Non O-A visa could cover all your stay, but there are several requirements and you should be fine just using the visa exemptions here.
If you don’t have a bank account in Thailand you’ll might need to get an agent to help you. You’ll need 15-21 days left on your current stamp to apply for a Non O and you’ll need the required 400K baht in your bank account at date when you apply. You’ll also need to provide documentation for your marriage. For the one year extension of stay you’ll need to have the 400K baht in your bank two months prior to the application. This is as an example the requirements for a Non O based on marriage at the immigration in Chiang mai just so you have a clue, but I advise you to get handed over the list of requirements from your state immigration before you apply.