How long is your flight? I have just enough energy to get home to Berkeley from Oakland when I land at 10 PM. (Which is how I usually travel!) And I'm usually just coming from Southern California.
Yes, there are some good business districts in the East Bay that meet your needs. However, I'd like to point out that the Bay Area in general is not a late-night destination kind of place. Your dining options are pretty limited after 10 PM, especially on Sunday-Thursday nights.
As for safety: Like any major metropolitan area, there are good and bad parts. Berkeley is generally safe. So is Alameda. Parts of Oakland are, parts aren't. Most of Richmond is NOT safe. Etc.
Considering the options, I think you'd enjoy Alameda. The area around Park Street is very close to Oakland Airport, at most 10 minutes by car, and has several bars and restaurants. Some will be open late. Accommodations in the area are few, with the closest being the Coral Reef Inn (http://www.coralreefinn.com). The hotel actually is on Park Street, but it's near the beach rather than in the center of the business district (which starts around Encinal Avenue).
Should you not wish to stay at the Coral Reef Inn, you may want to consider the Marina Village Inn (http://www.marinavillageinn.com) or Hawthorn Suites (http://www.oaklandhs.com) in Alameda or the Executive Inn (http://www.executiveinnoakland.com) or Waterfront Hotel (jdvhotels.com/hotels/…waterfront) in Oakland. Hawthorn Suites is in a small business district, and the Waterfront Hotel is in the respectable Jack London Square area of Oakland, but the other two are not near any restaurants or nightlife at all.
Note that I have not stayed at any of these hotels, only seen them from the side of the road. They are not especially fancy, perhaps in the 2-star (Coral Reef Inn) to 3-star (Waterfront Hotel) range. If you want fancy, you'll have to travel to Berkeley and stay at the Hotel Shattuck Plaza (http://www.hotelshattuckplaza.com) in downtown.
Personally, I would not want to drive all the way to Sonoma that late at night, and a fancy hotel seems like a waste considering your late arrival.