would early gold discover spur even further territorial loses for Mexico? Baja California, Sonora, possibly Chihuahua.
Good question. There was a moderate push for those areas OTL plus Yucatan, or even all of Mexico. The Mexican-American War turned into a quagmire and was the Iraq War of its time, complete with misinformation and conspiracy theories, and a protracted occupation of the enemy. People think about it being, oh border dispute with Texas, we occupied the territories we wanted, we won the war, we got what we wanted. But in reality we occupied Mexico City and the entire country, and later figured out what we wanted to keep, what they'd give up without further resistance, and went from there.
The Trans-Continental Railroad was really spurred by the Civil War and the need to make sure California, the Mormons, and the rest of the West never got the idea of secession even if they didn't join the South. There's a reason the Union Pacific was chartered in 1862. Even though since 1848 California was American part of the delay was where the eastern terminus would be- Northern non-slave, or Southern pro-slavery. The Civil War made the decision for Council Bluffs easier. So we might not see an earlier Transcontinental Railroad, and we might even see an early Civil War. Which means no Lincoln in charge, possibly Grant too young to distinguish himself. Winfield Scott might be young enough to actually be in charge of the Union. Robert E. Lee at a younger age might not go with the South. It's possible certain states might not secede either. Or maybe they do. Maybe Southerners get Missouri and even Kansas and Kentucky in an earlier Civil War.
An earlier gold rush, therefore an earlier Mexican-American War, could also mean more time before a Civil War in which more filibustering is successful in incorporating more overseas territory into the US. Maybe even an earlier Cuba, which probably means no conquest of the Philippines unless the US decides to bully Spain a second time.