Upvote:2
Technically a visit to Mexico does not 'reset the clock' on your 90 days of allowed stay. However the purpose of that rule is to prevent people making 'visa runs' across the border at the end of their ninety days and immediately starting a new 90 days. If you are clearly not doing that you shouldn't have a problem.
The actual standard for a Visa Waiver Program (which is actually what allows you to stay in the US - ESTA is just permission to get on a plane) is "short, occasional visits". It's the immigration officer's judgement as to whether that is the case. Maxing out your 90 days didn't help you, but being 90 days in Mexico is certainly a big help. The shorter the time you spend in the US after that the better it will be. Driving straight up to San Francisco and getting right on a plane home shouldn't be a problem. Obviously you need to have all the documents that show you will be actually leaving the US at the ready.
Theoretically an immigration official can deny you entry if he doesn't like your story, but it isn't likely in this case.