Were the Union vs Confederate sympathies in the South more of a divide along class lines with small farmers vs planters?
It’s a bit tricky, because it was both class and slavery.
If you look at the political sympathies/activities of the lower classes (i.e, small farmers, tenant farmers, laborers, and other non-slave owners). who lived in counties where there was a lot of slavery – i.e, the so-called “black belt” – they tended to be a lot more pro-slavery, pro-secession, and pro-Confederate compared to their class peers in the “Upper South” and the hill country (Appalachia, the Ozarks, certain parts of Texas, etc.) where there were few slaves.
And this was the case both before, during, and after the Civil War.

Historians have tried to explain this divergence in political behavior in different ways: some historians have emphasized that poorer whites in the “black belt” were economically dependent on slavery in ways that their peers in the mountains weren’t – that if they didn’t own slaves, they often rented them from their wealthier neighbors; that they often worked as overseers or slave patrol members or worked for slave traders or other occupations dependent on slavery; and that their vision of upward mobility was getting their hands on cheap land out west and buying slaves and becoming planters.
Other scholars more focused on questions of culture and identity, arguing that poorer whites in the plantation regions were more likely to fear slave uprisings and thus more likely to buy into the cross-class racial arguments of slave masters that all whites shared a common interest in slavery (i.e, the so-called mudsill theory), and that by being in close proximity to the planter elite, they were exposed to the cultural, social, and political dominance of that class and thus more likely to buy into paternalistic, patronage-based politics.
To be clear though, this isn’t to say that whites in the Upper South or Appalachia were all racial egalitarians; plenty of them were hostile both to slavery and to the slaves themselves. But it did mean that they tended to be more likely to vote against secession, to fight for the Union, and to vote Republican during Reconstruction.