Hello gorgef, not trying to put you off the dream but when searching for your boat and you find one that suits your funds, be aware that if you decide that you can fix up some of the things later, the costs can really start to add up. Below is a quick $75,000 that you may incur with a 40 footer.
Try to keep looking for a boat that someone has already done the work on so you don't have to. Buying a big boat that needs work could result in you never realising your dream of blue water sailing due to financial restraints. For me, nearly every job I start on the boat seems to get bigger and cost more than first anticipated and I'm sure I'm not Robinson Crusoe (well maybe Crusoe) with regard to this quirk.
And then there are the ongoing costs, like mooring/marina/antifouling/insurance/engine service/general maintenance that you need to factor into boat ownership.
Cheers

. (Yeah, also get the misses involved with the purchase so it's a joint project with commitment/ownership from boat parties)
Anchor Winch $3,000
Wind Generator $2,000
Life raft $2,500
Paint Job - Complete Exterior $20,000
Water Maker $6,000
Inverter $500
Sails - Main and Genoa $5,000
Deck Hardware $4,000
Tender $1,000
Outboard $1,000
Ground Tackle $1,500
Electronics $7,000
Paper Charts $500
Electronic charts $300
Replace Batteries & Charger $2,000
Toilet & Holding Tank etc $2,000
Targa & Davits $10,000
Update Safety Gear $500
Electric Auto Pilot $1,200
Wind Steering gear $4,000