Wealthy industrialist Phillip Colbert and his wife travel to Sparta, Mississippi, to oversee the construction of a new factory. One fateful night, police officer Sam Wood stumbles upon the body of Colbert, brutally murdered and left on the street. Wood arrests Virgil Tibbs, a black man carrying a substantial sum of money, at the train station, believing him to be involved in the crime. However, things take a dramatic turn when police chief Bill Gillespie discovers that Tibbs is, in fact, a renowned homicide detective from Philadelphia, who was just passing through after visiting his mother. Although Tibbs is eager to leave town, his superior encourages him to stay and assist Gillespie with the investigation.
As the investigation unfolds, a doctor reveals that Colbert's murder had occurred less than an hour prior to the discovery of his body. Tibbs inspects the scene and makes a crucial observation, concluding that the murder must have taken place much earlier than originally determined. He suspects that the killer is right-handed and deduces that Colbert was moved after being killed elsewhere.
The case intensifies when Gillespie arrests another suspect, Harvey Oberst, who claims his innocence. To force a confession, the police plan to use brutality, but Tibbs's keen insight reveals Oberst's left-handedness and alibi, proving his innocence. Colbert's widow, frustrated by the police's shortcomings, insists that Tibbs lead the investigation, leaving the town's elite no choice but to comply.
Tibbs suspects wealthy plantation owner Eric Endicott, a respected yet visibly racist figure in Sparta, may be involved in the murder. During an intense interrogation session, Endicott slaps Tibbs, who retaliates, leading to a confrontation with a group of thugs sent by Endicott. Despite Gillespie urging him to flee for his safety, Tibbs remains steadfast in his mission to solve the murder.
Together with Officer Wood, Tibbs retraces the route of Wood's patrol car on the night of the crime. They uncover a peculiar detour Wood took to avoid driving by the house of Delores Purdy, a young woman who seeks to attract him. Following a series of revelations, it is discovered that Wood made a suspicious bank deposit the day after the murder, leading to his arrest. However, Tibbs asserts that the murder occurred at the construction site, which clears Wood of direct involvement.
As racial tensions heighten, Delores's brother Lloyd confronts Wood with accusations of statutory rape. The situation escalates when Lloyd, enraged and driven by racism, rallies a lynch mob to target Tibbs. In a tense moment, Tibbs pressures illegal abortionist Mama Caleba for information, leading to a confrontation with Delores's dangerous boyfriend Ralph Henshaw.
In a dramatic turn, Tibbs reveals that Delores's purse contains the $100 Ralph gave her for an abortion—money he acquired through Colbert's murder. This revelation leads to a violent encounter where Lloyd is shot dead by Ralph, who then confesses to killing Colbert during a robbery gone wrong.
The story culminates as Tibbs prepares to board his train back to Philadelphia, bidding farewell to Gillespie. In a heartfelt exchange, Gillespie, having carried Tibbs's suitcase, expresses genuine care, saying, > "You take care, you hear?" After a brief pause, Tibbs responds with a warm smile and a simple "Yeah," solidifying a bond that transcends the racial tensions and differences that defined their tumultuous relationship.