Charleston, South Carolina (CNN) -- The four remaining GOP candidates played to their individual strengths on Thursday and tried to leave a lasting impression in a final, boisterous debate two days before South Carolina's pivotal primary.
In a campaign cycle where debates have had direct consequences on the ebb and flow of the race, former House Speaker Newt Gingrich turned his contempt for the media into one of his strongest performances yet. When CNN Chief National Correspondent John King opened the debate with a question about open marriage, following an interview by Gingrich's ex-wife saying that he had sought one, the Republican chastised him.
"To take an ex-wife and make it two days before the primary a significant question in a presidential campaign is as close to despicable as anything I can imagine," Gingrich told King, the moderator of the debate.
Gingrich's response elicited loud applause from the audience.
The debate came at the end of a ground-shaking day that saw former Pennsylvania Sen. Rick Santorum being declared winner of the Iowa caucuses more than two weeks after his apparent second-place finish to former Massachusetts Gov. Mitt Romney and Texas Gov. Rick Perry dropping out of the race and throwing his support to Gingrich.
Texas Rep. Ron Paul was the fourth candidate in the debate.
An angry Gingrich chastised CNN for starting off with the question about his marriage.
Hours before the debate, ABC News and The Washington Post released interviews with Marianne Gingrich in which she alleged Gingrich asked for an "open marriage" before their divorce.
Marianne Gingrich told The Washington Post that a day after her husband told her about his affair with Callista Bisek in May 1999, the former House speaker delivered a speech titled "The Demise of American Culture" to a group of Republican women in Pennsylvania.
"How could he ask me for a divorce on Monday and within 48 hours give a speech on family values and talk about how people treat people?" Marianne Gingrich said in her interview with the Post.
Gingrich said the story was false.
The three other presidential candidates on the stage passed on the chance to criticize Gingrich over the allegations by his ex-wife.
Romney took the steady, cautious route that he has throughout the campaign, responding to his rivals only when attacked.
Santorum presented himself as a more conservative option to Romney than Gingrich and as the candidate who could draw an effective contrast in the fall with President Barack Obama.
As the debate was going on, Gingrich's campaign released his tax returns as he had promised to do earlier. Romney was asked if he would follow his father's lead in releasing 12 years of tax returns. Romney's father, George, ran for the 1968 Republican presidential nomination.
"Maybe," Romney said, before highlighting his business experience and his personal success. "I didn't inherit money from my parents. What I have, I earned."
As he had earlier this week, Santorum said he filed his own returns and they were at home on his computer and he would release them once he returned home. Paul said he had no intention to release his returns, arguing that congressional financial statements are revealing enough.
The issue of electability was hotly debated. Earlier this week, Gingrich called for both Perry and Santorum to drop out of the race and support his candidacy because they didn't have the experience for a large undertaking like a presidential campaign. With Perry gone, Santorum was left to respond.
"Grandiosity has never been a problem with Newt Gingrich," Santorum said, arguing that he's the steady choice and Republicans shouldn't pick a nominee who might surprise them.
While Gingrich and Santorum debated their records in Washington and specifically who was more responsible for the Republican Revolution of the 1990s, Romney raised his hand to argue it's time for a Washington outsider.
"We need to send to Washington someone who has not lived in Washington, but someone who's lived in the real streets of America," Romney said.
Every candidate onstage said they opposed the anti-Internet piracy bill roiling Congress, and criticized the proposal for being too intrusive. However, both Romney and Santorum said they could support a more narrow law that would help protect intellectual property rights online.
Displaying the off-the-cuff wit he has used to great effect at a series of GOP debates, Gingrich joked he was none too sympathetic to movie and music producers who pushed for the legislation.
"You're asking a conservative about the economic interest of Hollywood," Gingrich said to laughter in the audience. "And I'm weighing it, I'm weighing it. I'm not rushing in."
Meanwhile Paul touted his libertarian-leaning views, adding he had been an early detractor of the bill. He said as president he would be unique in his ability to work with leaders on both sides of the aisle to protect civil liberties.
The former obstetrician and gynecologist forced his way into the conversation on both health care and abortion, two issues he knows a lot about.
"I thought maybe you were prejudiced against doctors and a doctor that practiced medicine in the military or something," Paul told King after a section where the other three candidates answered a question on whether a full repeal of President Obama's health care reform was truly possible.
After a lengthy debate among the other three candidates over the legitimacy of criticizing Romney's political conversion from pro-abortion rights to anti-abortion rights, the crowd booed and chanted Paul's name when King moved on without letting Paul weigh in.
"John, once again, it's a medical subject and I'm a doctor," Paul said.
Four polls over the last two days show Romney's long-held lead in South Carolina nearly evaporating into single digits by the time the four took the stage, while Gingrich has surged into a virtual tie. Gingrich on Thursday grabbed a major endorsement when Perry announced he was backing Gingrich as he suspended his campaign.
Santorum's campaign got a boost on Thursday when the Iowa GOP released the final certified results from its January 3 caucuses, which reversed Romney's eight-vote victory and instead determined that Santorum had won by 34 votes.
CNN's Adam Aigner-Treworgy contributed to this report.