Or, alternatively, the War of 1812 ends as OTL, but there's a later war between the US and the UK over the Oregon Country or the border of Maine. The US gets clobbered, there are internal divisions, and a weakened US is unable to bring as much force to bear against Mexico.
Another possibility...