Once the results of the U.S. midterm elections this Tuesday are official, politicos will turn to the 2020 presidential election.

And the new movie The Front Runner — which is getting a limited election-week release before it opens nationwide on Nov. 21 — offers a cautionary tale for future candidates.

It’s based on the true story of the fall from grace of former Colorado Senator Gary Hart. Played by Hugh Jackman, he was “the clear front runner for the Democratic nomination” in the 1988 presidential election, according to TIME, until he was forced to drop out of the race. The scandal hit just over 30 years ago, after the Miami Herald revealed that the married man had been spending nights with another woman — Donna Rice, a 29-year-old model.

Hart’s political career ended rather quickly. On Monday, April 27, 1987, Miami Herald politics editor Tom Fielder received an anonymous tip that in late March, Hart had attended an overnight trip on a yacht rented by lawyer-lobbyist William Broadhurst named Monkey Business. According to the tip, as they sailed from Miami to Bimini, he hit it off with a woman who was not his wife. The tipster — later revealed to be clothing designer Dana Weems — offered photos to prove it and said Rice was going to fly up to Washington, D.C., to see him.

By May 1, Herald investigative reporter Jim McGee was on a plane, and had staked out Hart’s D.C. townhouse. Hart was seen leaving the building with a woman who was not his wife shortly after 9 p.m., returning with her shortly after 11 p.m., and then leaving with her the next evening.

When the Herald confronted him, Hart denied that he was having an affair with the woman and said only that he was taking her back to where she was staying. On May 3, 1987, their story appeared in the Herald with photographic evidence of the two together from the stakeout. At a televised press conference in New Hampshire, a Washington Post reporter asked Hart point-blank whether he had ever committed adultery. “I don’t have to answer that,” Hart responded. Donna Rice, in another press conference with reporters, said she and Hart were “just pals” and added that she preferred “younger men.”

And yet two days later, Hart suspended his campaign. “I’ve made some mistakes,” he said. “Maybe big mistakes, but not bad mistakes.”

Just over two weeks later, the National Enquirer published a photo of Rice sitting on Hart’s lap.

In the case of Gary Hart, the problem wasn’t what he did, but how he did it. Americans didn’t like hypocrites. They couldn’t rally around a candidate whom they felt wasn’t being straight with them, pundits observed. A TIME poll conducted shortly after the news broke found that when Americans were asked what bothered them more, extramarital sex or “not telling the truth,” 69% said the latter and 7% said the former.

TIME’s May 18, 1987, cover story on the scandal described the perception of hypocrisy that did Hart in:

Yet the facts, as ambiguous as some of them are, make clear that Hart brought on his own downfall. Ever since he reconciled for the second time with his wife Lee in 1982, Hart has portrayed himself as a dutiful husband whose 28-year marriage was strengthened by the stress of separation. But in his private conduct, Hart challenged the moralistic conventions of political behavior and ultimately paid the price for his apostasy. Until the very end Hart seemed oblivious to the reality that his actions had consequences. He denied there was anything improper about his friendship with Donna Rice, even though it is far from customary for 50-year-old men to spend weekends away from their wives hanging out with comely actresses who have appeared on Miami Vice. Hart jeopardized his reputation for veracity by angrily denying the persistent rumors about his womanizing… Rather than wrestling with the complexities of arms control and a troubled economy, the public tends to look for personalities they can trust, whose judgment and integrity make them feel comfortable.

The scandal marked a turning point in how the media covered the private lives of public figures. “Political journalism may never be the same,” TIME said. Some media experts thought the Herald‘s stakeout was too forward for a mainstream news outlet; TIME and other news outlets said Hart was asking for the comeuppance because of his earlier challenge to the New York Times magazine that reporters could feel free to “put a tail on me,” and his warning that they’d be “bored.”

TIME argued that journalism had simply evolved and adapted to societal changes, on top of a plummeting trust in government because of the Vietnam War. Historically, when journalists found out that public-office-holders like President John F. Kennedy were having affairs, they didn’t report on them because such trysts weren’t considered newsworthy. However, TIME observed, “with the breakdown of sexual taboos in the 1960s, public discussion of such topics became more acceptable. At the same time, with the changing status of women, society has grown less tolerant of the macho dalliances of married men.” The more candidates and politicians appeared on TV, the more that the line between movie stars and political figures became “blurred,” and the more there was a need for media consultants who could create this image of the politico for the general public. Now the job of journalists was to find out who these people really were.

As for what happened to the main characters, Massachusetts Governor Michael Dukakis became the Democratic nominee and lost the 1988 presidential election to George H.W. Bush. Gary Hart went back to practicing law, serving on a variety of advisory councils, and was the U.S. special envoy to Northern Ireland in the Obama administration; he is still married to his wife Lee. Donna Rice Hughes married in 1994 and is an activist who works to rid the Internet of child pornography — and who has made it clear that she will have more to say in the future. In a recent statement about the 2018 film, she wrote that she is working on a memoir, that “all the truth is not out, as I have never told my own story.”

Write to Olivia B. Waxman at olivia.waxman@time.com.