A war with Mexico probably would help heal the rift between North and South faster than it had in OTL, simply because now America has a common enemy again.
One way that Mexico might get crazy enough to attack the United States during this period is if, say, Porfirio Diaz is somehow able to seize the presidency. Diaz at this time was highly popular among the Mexican people, the troops especially, for his actions against the French and it would not be too much of a stretch that he could become the president of Mexico by the late 1860's. Perhaps Diaz, made overconfident after expelling the French from Mexico, would then decide he might as well try and take back territory from the Gringos.
If Mexico were to make its ill-fated invasion of the United States, it might take a little while for the bulk Federal troops to make it to the border regions, mostly because most of the infastructure of the South is still destroyed. Yet once those troops arrive, Diaz and whichever generals he has in his staff would have to deal with experienced veterans led by able generals, not to mention the overwhelming material and technological superiority of the US. The US navy will also have total naval superiority over Mexico, and enforce a crippling blockade. So basically, Mexico may be able to seize the initiative for a couple months at the most, overrunning a few border towns and the like, before they get absolutely crushed. European intervention would probably be unlikely, and I highly doubt that Mexico could swallow its pride to accept it, since they only kicked out the French only a few years before. I would expect that the US would snatch a good chunk of territory, make them pay reparations, install a US friendly regime, and basically reduce them to impotence. As for Diaz, he'll probably spend the rest of his days in exile.
One other social effect is that there could be many regiments of newly-freed blacks, which may help them gain more political rights and perhaps, just perhaps, lessen the Southern animosity toward them (ie:less severe Jim Crow laws).