In New York City, Jeffrey Andrews is a disheveled, alcoholic novelist living in a cluttered apartment. He stomps out to confront his publisher, Henry Small, about a pay dispute, only to find himself thrust into a tense standoff at Small’s office. There, he barges past secretary Evelyn Green, a woman whose admiration for his work is clear, into a room where Small has been conferring with the celebrated mystery writer, Lloyd Harrison. The clash is practical and pointed: Small refuses to pay more, urging Andrews to pursue more marketable fare, while Harrison defends the integrity of psychological fiction and its demand for logical solutions rather than mere red herrings.
In a bid to shake things up, Andrews offers Small a plot outline for a whodunit in exchange for a cash advance. Small declines, yet under Harrison’s encouraging influence, Andrews improvises a complete, though secretive, plot about a locked-room murder where the victim’s fate and the killer’s escape remain unexplained. After he leaves, Harrison voices fresh complaints about his own contract, and Small calls Evelyn into his office. Andrews retreats to a bar within the office building, where he shares the imagined plot with the bartender, a conversation that happens while he narrowly misses crossing paths with Harrison as he wanders the hallways. Evelyn soon arrives, her torn dress signaling she’s learned about Andrews’ celebrated work, and the two discuss the characters and the ideas that intrigue her.
Back in Small’s office, Andrews discovers his contract abandoned in a file drawer and tears it up. Sometime later, Detective Lt. Fred Applegate arrives to arrest Andrews on suspicion of murdering Small, whose body is found in his inner office—spelled shut from the inside. Applegate interrogates Andrews, who is too intoxicated to articulate the ending of his own imagined crime. Evelyn is missing, and Harrison arrives at the scene, suggesting that Applegate release Andrews into Harrison’s custody so he can discern how the murder was accomplished. At Harrison’s apartment, Andrews remains unable to remember the ending, and that night he slips out to locate the bartender he spoke with earlier. A night watchman escorts him to the bartender’s apartment, only to discover the bartender has been killed. When Andrews discovers one of Evelyn’s earrings beside the body, he is shot by the watchman but manages to escape.
Returning to his apartment under police surveillance, Andrews finds Evelyn there. The two remain wary of one another, though Evelyn insists she has fallen in love with him. Over coffee at a diner, Andrews identifies Evelyn as the wearer of the other earring and contemplates turning her over to the police, even though she doesn’t know about the bartender’s murder. On the way to the station, he pockets a check from Small and begins to suspect that Small planned to buy his story and that Harrison may have been present. The confrontation with Harrison intensifies inside Harrison’s apartment, where Harrison tries to shake Andrews’ confidence in his own memories and pushes him to recall the solution to the locked-room mystery. Before long, the police arrive and arrest Andrews.
At the police station, Andrews, furious and frustrated, confesses to Small’s murder, though he cannot remember the ending of the bartender’s murder. He refuses to confess to the bartender’s killing, a move that leads Applegate to suspect Evelyn. Yet Andrews grows convinced that Harrison stole one of Evelyn’s earrings to frame her. Applegate also notices that Harrison’s contract with Small is missing from the evidence. The night watchman reappears and reveals a crucial detail: the bartender told him that Harrison had been in the bar on the night of the murder but left to wash his hands, giving him time to kill Small. The watchman confronts Harrison with a gun, but Andrews disarms him. Harrison then retrieves his own pistol and is shot by Applegate. Before dying, Harrison confesses to the murder, admitting that Small had threatened to expose him for using a ghostwriter and that he killed the bartender to cover his tracks. As the sun rises, Andrews and Evelyn walk away from the station, their fates intertwined yet finally free of the immediate danger.