Plot
In September 1966, wealthy industrialist Phillip Colbert and his wife are in Sparta, Mississippi, to oversee the building of a factory. Late one night, police officer Sam Wood discovers Colbert's corpse in the street. Wood finds Virgil Tibbs, a black man with a fat wallet, at the train station and arrests him. Police Chief Bill Gillespie accuses him of murder and robbery, but learns Tibbs is a homicide detective from Philadelphia, who was passing through town after visiting his mother. Tibbs wants to leave town on the next train, but his Chief in Philadelphia requests Tibbs stay in Sparta to help Gillespie with the murder investigation. Though Gillespie, like many of Sparta's white residents, is racist, he and Tibbs reluctantly agree to work together.
A doctor estimates that Colbert had been dead for less than an hour when his body was found. Tibbs examines the body and concludes that the murder happened much earlier, the killer was right-handed, and the victim had been killed elsewhere and moved to where Wood found his body.
Gillespie arrests another suspect, Harvey Oberst, who protests his innocence. Tibbs, after being jailed for withholding his findings after examining the body, reveals that Oberst is left-handed and has witnesses to confirm his alibi. Frustrated by the ineptitude of the police but impressed by Tibbs, Colbert's widow threatens to halt construction of the factory unless Tibbs leads the investigation.
Tibbs initially suspects the murderer is wealthy plantation owner Eric Endicott, a genteel racist and Sparta's most powerful citizen, who opposed Colbert's new factory. When Tibbs begins interrogating him, Endicott slaps him, and Tibbs slaps him back. Gillespie accuses Tibbs of also being racist for focusing the investigation on Endicott. Afterwards, Endicott sends a gang of thugs after him. Gillespie rescues Tibbs and tells him to leave town to save himself, but Tibbs is determined to stay and solve the case.
Tibbs asks Officer Wood to retrace his patrol car route during the night of the murder; Gillespie joins them. After questioning why Wood detours from his patrol route, Tibbs discovers that Wood enjoys passing the house of 16-year-old Delores Purdy, who walks around nude with the lights on in an attempt to entice men, and that Wood changed his route to prevent Tibbs from seeing her. Gillespie learns that Wood made a $632 deposit to his bank account the day after the murder. He arrests Wood, despite Tibbs's protests that he is not the murderer. Tibbs tells Gillespie that the murder was committed at the site of the planned factory, which clears Wood because he could not have driven both his car and Colbert's car back into town.
Delores' older brother Lloyd, a hostile racist, brings her to the police station to file statutory rape charges against Wood for getting her pregnant. When Tibbs insists on being present during Delores' questioning, Lloyd is offended and gathers a lynch mob to attack Tibbs.
Tibbs pressures illegal abortionist Mama Caleba to reveal that she is about to provide an abortion for Delores. When Delores arrives and sees Tibbs, she runs away. Tibbs follows Delores and confronts her armed boyfriend, Ralph Henshaw, a cook at a roadside diner. Lloyd's mob arrives and holds Tibbs at gunpoint.
Tibbs tells Lloyd to check Delores' purse for the $100 Ralph Henshaw gave her for an abortion, which he got from killing and robbing Colbert. Lloyd realizes that Tibbs is right when he opens the purse and finds the money. After Lloyd confronts Henshaw for getting his sister pregnant, Henshaw shoots Lloyd dead. Tibbs grabs Henshaw's gun. Henshaw is arrested and confesses to killing Colbert.
Gillespie carries Tibbs’ suitcase to the train station and bids him farewell. They warmly smile at each other, making it clear there was no longer animosity between them.