If every Whig president elected hadn't died in office that might have helped... More importantly though the Whigs just need to come down on a side of the sectional divide to survive. As it was they only managed to alienate both sides.
More importantly, it would have to come down on the Southern side. A party that takes the Northern side explicitly is going to have to adopt a program that the Whigs couldn't have lived with as a party (the economic nationalism of the Republicans was significantly watered down by the economic Jacksonianism of the Free Soilers), and the only reason the Democrats survived where the Whigs didn't was because they made peace with the Slave Power and, eventually, became the sectional party of the South, almost exclusively.
This is difficult because, while the Whigs certainly had a constituency in the South, it just wasn't as large as that of the Democrats.
The death of the Whigs was bound up in the rising sectional crisis and their attempt to be 'moderates' (offering compromise, not resolution on the slave issue, B-29 says) becomes increasingly untenable as the passions on both sides increase. You'd need to get rid of the entire build-up to the Civil War to save the Whigs, which is...difficult.