Sooo...maybe a British explorer around 1800 discovers the massive gold reserves in California, brings the news back to Britain. During the Peninsular War, Britain takes the Bay Area for "safekeeping", and to plug the hole in their finances fighting Napoleon is leaving. They reluctantly hand it back to Spain after the war, but they barely get the benefit as Mexico secedes shortly thereafter. The flood of anglo-american settlers continues until they decide to break off and form their own country. Eventually, the american half of anglo-american decidedly outnumbers Brits and they move to unite with their mother country. I'm guessing that with a sizeable British contingent, it would not be a slave state.
This might result in America not getting Puget sound, though, as IIRC Polk had little desire to actually fight the British over 54'40'. The British could point out that we already have a fantastic west coast port in San Francisco, and "a port for a port" sounds like a compromise you could sell to the public, especially if it means not having to fear a British 5th column in California.