Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

As voters head to the polls Tuesday in a surprisingly competitive special election in Kansas, President Donald Trump put his political capital on the line by wading into a race that has given the GOP an unexpected run for its money.

No one had thought the special election to replace former Rep. Mike Pompeo, now Trump’s CIA director, would be much of a contest at all. Trump and Pompeo both won Kansas’ 4th Congressional District by around 30 percentage points last year, and national Democrats had not bothered investing any money in it until this week.

But weak polling and early vote returns, driven partly by the unpopularity of Trump and Republican Gov. Sam Brownback — ranked America’s least popular governor last year — have sent worried Republicans on a last-minute frenzy to prop up GOP candidate Ron Estes.

“Ron Estes needs your vote and needs it badly,” Trump said on a robo call produced by a GOP super PAC Monday.

On Tuesday, Trump made his most public intervention yet into any of the special congressional elections this year, using Twitter to boost the Estes in his bid to keep a seat the GOP has held for a quarter century.

Ron Estes is running TODAY for Congress in the Great State of Kansas. A wonderful guy, I need his help on Healthcare & Tax Cuts (Reform). — Donald J. Trump (@realDonaldTrump) April 11, 2017

Independent analysts and operatives in both parties still think Estes, the two-term state treasurer, will prevail Tuesday over Democrat James Thompson. The GOP is fretting more about his potential narrow margin of victory than losing outright, they say.

But Republicans have been forced to invest far more in the closing days of this race than they expected to.

Republicans greatly outnumber Democrats in the district, which is home to GOP mega donors Charles and David Koch. But Democrats are hoping their base's enthusiasm will make up for their numerical disadvantage in an election where turnout is expected to be low.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

If Estes loses or underperforms, it will be immediately interpreted as a bad omen for GOP electoral prospects in the Trump era.

Republicans are clearly worried. Since Thursday, as NBC’s First Read noted, the National Republican Congressional Committee has poured cash into a last-minute TV ad buy attacking Thompson, Texas Sen. Ted Cruz flew in to stump for Estes, and a Republican super PAC launched the robocalls from Trump and Vice President Mike Pence.

“I’ve heard people whose opinions I respect tell me they think it would be single digits,” Clay Barker, the executive director of the Kansas Republican Party, told the Kansas City Star.

The paper reported that an internal poll circulating among GOP operates showed Estes leading Thompson by just a single point last week.

Democrats are already looking for an upset in next week's special election in Georgia, a conservative district where 30-year-old Democrat Jon Ossoff is leading every Republican in recent polls.

RELATED: Trump's shadow is looming over Georgia special election

As alarm bells went off for Republicans this weekend, Democrats poured $200,000 into Thompson’s campaign in a matter of days through the liberal blog Daily Kos.

That’s a stunning outpouring of cash for a candidate who reported raising under $250,000 from the beginning of January through the end of March, according to his most recent FEC report.

And after steering clear of a race they believed they had no chance of winning for months, the official campaign arm of House Democrats, the Democratic Congressional Campaign Committee, also launched a last-minute round of get-out-the-vote calls Monday night, which will target 25,000 households in the district.

Thompson, meanwhile, is not exactly the kind of conservative Democrat one might expect to run in a place like Kansas.

A civil rights attorney who has brought lawsuits on behalf of people shot by police, Thompson favors legalizing marijuana and has said he decided to run for Congress because of Vermont Sen. Bernie Sanders.

“I’m totally new to politics — I was inspired to run by Bernie. After the election, I decided to get out from behind my Facebook keyboard and try to make a difference, so I decided to run for office,” Thompson said on a Reddit “Ask Me Anything” Forum hosted by the “Sanders for President” subreddit.

Thompson, who said his family was homeless for a time while he was growing up in Oklahoma City, joined the Army and was a member of the Presidential Honor Guard.

“The fact is, this election will be all about turnout, which is why we're hyper focused on getting volunteers on the phones to let voters know that there's an election,” Thompson said on the Reddit forum.

RELATED: Democrats vs. Trump: Full coverage

Thompson has put Brownback, rather than Trump, at the center of his campaign.

Last year, Democrats surprised many by flipping four state legislative seats in Kansas, which they credited in part to Brownback’s unpopularity.

A poll commissioned by the Kansas Center for Economic Growth at the end of March showed that just 24 percent of Kansans approve of the job Brownback is doing as governor, while two-thirds disapprove. And it’s not much better among his own party, with only 34 percent of registered Republicans giving him a thumbs up.