The Kansas-Nebraska Act in 1854 rang the death knell, though the party was already weak, in part because it was organized poorly and in part because the growing immigrant and Western populations preferred Democrats. Thing is, Whigs opposed slavery, but they also favored a more modern economy, rather than primarily farming, and the development of a strong mercantile sector, which neatly screwed over people who would stay on the bottom rung.
The problem was slavery: the struggle over slave and free states could not be settled permanently, and the time of nation-binding compromises was ending:
1) Three-Fifths Compromise (1787): States paid taxes and were assigned seats in the House of Representatives based on all of their free population and three-fifths of their enslaved population. The South wanted all the slaves to count as people for politics and none of them to count as people for taxes based on population.
2) Missouri Compromise (1820): Maine was admitted as a free state, and Missouri as slave, with slavery banned in states north of 36°30′, Missouri’s southern border.
3) Compromise of 1850: Texas gave up claims on New Mexico and lands north of 36°30′. California was admitted as a single free state despite being right on top of that line. The New Mexico and Utah territories could choose to permit slavery, despite the line running through the former and below the latter. The slave trade was banned in D.C.
The end began innocently enough: plenty of farmland was just waiting to be cultivated in the Great Plains, but settling it required a concerted program to get people in there growing corn and wheat. The railroad companies wanted this more than anybody, since more farmers in the territories meant more freight to get paid to transport. The prime mover was Stephen Douglas: railroad enthusiast, top Senate Democrat, wannabe President (along with nearly every other member of Congress), and fervent believer that each state had the right to decide for itself whether or not to allow slavery.
The Missouri Compromise in 1820 had settled tensions between the North and South until the Mexican-American War, banning slavery in every state north of Missouri’s southern border (36°30′) except Missouri itself and admitting Missouri as a slave state paired with Maine as a free state. The next major deal Congress had to broker to keep everyone from each other’s throats was the Compromise of 1850, the most relevant part in this case being that the New Mexico and Utah Territories, despite being north of Missouri in part or in whole, could decide to allow slavery. That wasn’t going to happen, since desert plantations grow sand and the residents didn’t want slaves anyway, but the principle was established.
To get the Southern support he needed for a railroad, and to promote the principle of popular sovereignty, Douglas proclaimed that Nebraska would allow slavery when admitted to the Union if the residents voted for a state constitution that allowed it. Douglas’s railroad bill ignored the Missouri Compromise rather than outright contravening it, hoping to avoid pissing off supporters, but that wasn’t good enough for Southern Whigs, who wanted to take some of the slave-supporting vote. Senator Dixon of Kentucky added an amendment repealing the 36°30′ line as a boundary against slavery, and Alabama Democrat Philip Phillips did the same in the House.
Party leaders, including President Franklin Pierce, decided to make the bill a matter of party loyalty, in part attempting to negate the Whig political move. After four months of debate/arguing among free-staters, popular sovereignty supporters, and slavers, the bill passed both houses. In the Senate, free states split 14-12 in favor, while slave states supported it 23-2. Democrats in the House were of two minds, Southerners backing it 57-2 and northerners again split 44-42 in favor; Whigs were much more mixed, with the northern contingent casting all 45 votes against, but the rest voting 12-7 for. Both parties split on the issue, but the Whigs were more solidly against it; many nay voters joined the infant Republican Party, which had been founded on opposition to slavery.
The Democratic Party became dedicated to the South, while the Republicans dominated the North. The country was becoming starkly divided, and in only six years, that divide would become a bloody reality.