I know - completely stupid right. I mean, that would be about as likely as a backward nation like Afghanistan winning wars against each of the superpowers or something.
An overstatement to say 'winning wars' -- militarily, Iraq and Afghanistan were not remotely a match for US power. Both countries were invaded and occupied within weeks, their organized state militaries having been completely dominated.
What followed, however, were insurgencies -- loosely organized civilian militias which created havoc in the civil order after actual military offensive operations had ceased.
There's a very important difference there.
Unfortunately, that difference also highlights that a loosely-organized group with only small arms can wreak havoc on a military occupation with guerilla-style tactics. It happened in Iraq and Afghanistan against part of US military power (obviously the "full might" of US military power was not wielded there, and significant conservative rules of engagement limited what US forces trying to maintain order were allowed to do), including all manner of airpower. That means it can most definitely happen at home, too.
Let's not forget that, even with very, very low US casualties over a decade of war, the US population had all ready lost much of their will to fight. Think of how that will would be different if those being killed on both sides of the fighting were US citizens.
The idea that the Confederacy did not win a war in the 19th century, and therefore no such uprising could ever succeed today (without having any idea what such an uprising would look like), is quite a leap of logic. In and of itself, that is meaningless.