Polk's refusal to accept the senate slot offered him in 1842 unknowingly affected his campaign for governor. The Whigs controlled one house of the legislature, the Democrats the other, although the Whigs had a majority in the joint session that selected legislators. The Whigs had agreed to offer the senate seats to one Democrat and one Whig, but when Polk turned down the offer the Whigs argued that no other Democrat held the same stature or respect. They decided to send two Whigs to the senate. The Democrats demurred and both sides held strong. The thirteen Democratic senators, later to be known as "The Immortal Thirteen," refused to meet in joint session to select the senators, and so Tennessee was left with no U.S. senators for two years. Both sides blamed Polk for the lack of representation and the matter dogged him throughout his campaign for governor. Polk lost his reelection bid again.
The loss presented a serious blow to Polk, as the presidential nominating convention was now a year away and he had no political office–nor any political success since the 1840 election. Andrew Jackson still held considerable sway in the party, and Polk hoped that Jackson would assist him. During a two-day conference at Jackson's plantation, however, Martin Van Buren gained the support of Old Hickory and, by extension, Polk. As Van Buren toured Tennessee, Polk stood by his side and everywhere they went hundreds turned out to greet them. But Polk had grown weary of standing at the sidelines; he had given Van Buren his support and had received nothing in return. Now, three states had nominated Polk for the vice-presidency and he had the support of much of the national party. In fact, if Van Buren wanted a chance of winning, he would have to select Polk as his running-mate. Van Buren still wanted his previous running-mate, R.M. Johnson, but after such a dismal showing in the 1840 election, it would be difficult to convince the party the team should be nominated again.
On February 28, 1844, the Secretary of State and Secretary of the Navy were both killed in an explosion aboard a naval vessel. President John Tyler offered the State Department to John C. Calhoun and the Navy Department to Polk–Calhoun accepted, but Polk passed on the offer. The Whigs wanted nothing to do with Tyler and the Democrats did not want him either, leaving him alone in a political netherworld. Polk continued to campaign for the vice presidency. Then, the Texas issue exploded.
The possible annexation of Texas had long been a controversial topic. Texas had applied for entrance into the Union, and that petition was now tied up in Congress. Polk seized the chance and wrote a strongly-worded letter demanding the immediate annexation of Texas and went one step further to insist on the annexation of the Oregon Territory, which both Britain and the U.S. claimed. He argued that to allow Britain to regain a foothold in the U.S. would be tantamount to treason. Both Henry Clay and Van Buren published letters opposing the annexation because it might lead to war and, moreover, because Texas' debt was too great for the U.S. to assume. If Texans paid down the debt, and Mexico allowed it, Texas could be allowed to join the Union. The letters pleased Clay's party and he was nominated for the presidency. Van Buren, though, had underestimated the importance the issue held in the minds of the members of his party. His letter all-but destroyed Van Buren's chances of re-nomination. Polk received an urgent summons to Jackson's plantation and when he arrived "Old Hickory" presented the guests with a toast: "A toast to the next President of the United States. To the health of James Knox Polk!"
The 1844 Democratic nominating convention was a disaster, a near-riot. Van Buren failed to achieve the necessary two-thirds, and after seven ballots, Van Buren's support was slipping quickly. On the convention's third day, the New Hampshire governor placed Polk's name in nomination. He was one of the few Democratic leaders trusted by both the pro-Van Buren and anti-Van Buren factions of the party. On the eighth ballot, Polk received forty-four votes of the necessary 176. But on the ninth ballot, everything shifted. State after state went to Polk, and by the half-way point on the roll call, his name was the only one left on the ballot. He was chosen unanimously–the first "dark horse" candidate in American history. The news of his nomination was quickly sent to Washington by telegraph–the first commercial message sent on the new Baltimore-Washington telegraph. It would be several days, however, before news reached Polk that he stood as the next candidate for the presidency. The news rocked Tennessee as well as the rest of the nation.
The campaign began. Editors in Whig newspapers traded barbs with the editors of the Democratic newspapers. The campaigns began to write parodies and songs for the race. Although neither Texas nor Oregon was mentioned in the Whig platform, it became clear that their respective annexation would be the hot issue of the year. Polk scored a political point by pledging to only serve one term if elected, whereas Clay–whose Whig Party had originally come up with the one-term plank–failed to make such a pronouncement. The Whigs hoisted ash trees at every rally (Clay came from Ashland) and the Democrats sought out the tallest hickory trees they could find–although they curtailed the practice after a 134-foot tall hickory tree collapsed and killed a supporter at a Maryland rally. The disputed Oregon boundary became a rallying cry for the Democrats who proclaimed "Fifty-four, forty or fight," a reference to the latitude of the disputed border.
On election-day, Polk lost his own home state by 112 votes. As the election votes trickled in. It appeared that Polk led the Electoral College, but everything hinged on New York and its thirty-six votes. The Nashville Whig newspaper had proclaimed that New York had gone for Clay, so it surprised everyone when news came that Polk had been chosen as president.