Republican Troy Balderson may have narrowly eked out a win in Ohio’s 12th congressional district over Danny O’Connor, but the victory came at a steep price.

Outside GOP groups spent millions to keep a House seat that had been in GOP hands for over three decades, winning by such a slim margin that news outlets wouldn’t call the race even as President Donald Trump was bragging about it on Twitter.

Some conservative groups were using the tightness of the race as a warning sign for the November midterms.

“While we won tonight, this remains a very tough political environment and moving forward, we cannot expect to win tough races when our candidate is being outraised,” said Corry Bliss, executive director of the Congressional Leadership Fund, a super PAC that is working to keep the Republican majority in the House. “Any Republican running for Congress getting vastly outraised by an opponent needs to start raising more money.”

Even though Republicans were the ones declaring victory Democrats seemed just as gleeful, if not more, especially since the two candidates will face off again in November.

“That this race is too close to call speaks volumes about Danny O’Connor’s strength and Republicans’ expensive, failed playbook. With twice as many registered Republicans as Democrats, this district should have been a slam dunk for the GOP, and the fact that we are still counting ballots is an ominous sign for their prospects in November,” DCCC Chairman Ben Ray Luján said in a statement. I have never been more confident that we will take back the House and elect an incredible group of Democrats in November.”

Unlike the last special election in Pennsylvania, where the Democratic candidate Conor Lamb outraised Rick Saccone 3 to 1, Balderson was better suited to take on O’Connor financially, although he was still operating at a deficit. He had raised a little over $1.2 million by July 18, according to public records with the federal election commission, and had spent a little over $1 million. O’Connor had raised nearly $1.5 million and had spent $1.35 million, but had vastly outspent Balderson when it came to television advertising.

According to data obtained by TIME, Balderson had only spent $507,206 on television ads as of August 3, while O’Connor had spent over $2 million.

But, as was the case in Pennsylvania, outside spending by Republican groups dwarfed the Democrats. The Congressional Leadership Fund, a Republican super PAC aligned with retiring House Speaker Paul Ryan, spent $3 million, including $2.7 million on television ads, and has had staffers on the ground there since June. The Republican National Committee spent $650,000 and manned over 700 volunteers in get out the vote efforts. In the two and a half weeks since Trump endorsed Balderson, America First Action, a Super PAC that advocates for his legislative agenda, spent $200,000 investing in voter turnout.

In June, a Monmouth University poll showed Balderson ahead by 10 points. But another Monmouth poll released last week showed O’Connor was only 1 percentage point behind his Republican counterpart in two of the three voter turnout models. “Too close for the GOP’s comfort,” Dan Eberhart, a Republican donor, wrote to TIME in the hours leading up to the race.

Republican strategists also conceded the race was tougher than initially envisioned.

“It’s closer than originally thought, but it’s a challenging midterm environment,” said one national Republican strategist involved in the race. “It shouldn’t come as a surprise when races are challenging.”

Some Democrats, however, definitely didn’t expect this; outside groups definitely invested, but not to the same extent. The Democratic Congressional Campaign Committee spent $630,000 on television ads. And three outside Democratic groups, House Majority PAC, Priorities USA, and For Our Future, launched a $140,000 investment in digital and field campaigns in late July. But these numbers look like chump change compared to some of their Republican counterparts.

This gap intensified as the race got tighter. In the past week alone, the RNC, CLF, America First Action, and the National Republican Congressional Committee, America First Action spent over $885,000 bolstering Balderson through get out the vote efforts and digital advertising, according to FEC records; within that time frame, outside Democratic groups supporting O’Connor did even half of that.

It’s not like Republicans don’t have the money to spend. CLF raised $51 million in the second quarter of 2018, bolstered by a $30 million donation from GOP mega-donor Sheldon Adelson, and had $71 million cash on hand as of last month. The group has already reserved $60 million in advertising for the fall elections.

But at this point, Democrats only need 23 seats to regain the majority in the house. With at least 30 seats currently held by Republicans being classified as toss-ups, those outside Republican groups may need all that money and more.

Get our Politics Newsletter. The headlines out of Washington never seem to slow. Subscribe to The D.C. Brief to make sense of what matters most. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Write to Alana Abramson at Alana.Abramson@time.com and Abby Vesoulis at abby.vesoulis@time.com.