WASHINGTON — After Senator Heidi Heitkamp of North Dakota announced that she would not vote to confirm Judge Brett M. Kavanaugh to the Supreme Court, sympathetic voters went to work to show their support for the embattled red-state Democrat, writing letters of thanks and posting their appreciation on social media.

Others found a more practical way to demonstrate their gratitude: cold, hard cash. In 17 days, Ms. Heitkamp raised an astonishing $12.5 million, according to campaign finance filings; the bulk of that was after she announced her vote.

“This stands in its own class,” said Michael Beckel, a campaign finance expert at Issue One, a nonpartisan group that seeks to reduce the influence of money in politics.

The senator is struggling in her fight for re-election against a Republican challenger, Representative Kevin Cramer, who has opened a clear lead in recent polls. Republicans see the race as a key opportunity to widen their majority in the Senate.