In terms of upgrading and selling for more; not really unless you buy a "marina boat"; and usually those boats need way more than just cabinetry work. Hardware is very expensive; slip fees more; and that's where you lose the cost effectiveness of boat buying and re-selling.
27 ft boat would be about the smallest keelboat you would want to be comfortable on SF Bay. Anything smaller than a ~36 will get wet and be rough on heavy wind days. Racers sail boats this size and smaller but are also prepared to be taking a green shower all day also. I think you could pick up a 'fixer' in the 30' range for under 20k. Look for a well kept but in need of cosmetics Newport 30 or Catalina 30. If you want more performance look at an Olson 30; but might be hard to find one as they have an active racing one-design fleet. Express 27 would also make a nice sport boat. You might also look at a Wylie 30.
Going out the Gate and coastal is another proposition. While smaller (30' or less) boats do go out; crossing the SF Bar can be treacherous even for larger boats. I don't know what your sailing experience is; but be careful when it comes to going out the gate, especially if you are in a boat less than 36' LOA. We have gone out many times when the predictions seemed OK and turned back after getting into steep 12-15' swells with cresting waves further out. Don't sail out on a strong ebb if there is any swell running. It only makes the swells 'stack up' taller and steeper on the Bar.
Take your time. It's a buyer's market. If you find something post some info here and ask for advice. Fall and winter weather is the best time of year to sail in light winds between storms and get acquainted with your new boat.