While the Baldpate Inn is closed for the winter, mystery writer Kenneth Magee makes a $5,000 bet with its owner that he can spend one night there and write a story. He starts the work while on the train there, but a stranger named Mary Jordan manages to steal the typed pages. At the station she tries to warn him not to go there, but he does. Believing he has the only key, he is surprised to find Cargan, who says he is the caretaker and was not expecting him. There is no electricity, but Kenneth is willing to work by an oil lamp and firelight. Then Mary turns up at the inn and the weather is bad enough that she is given a room as well. Kenneth again starts writing his story, A Key to Baldpate. But then other people also begin arriving, and behaving suspiciously. Also, an innocent-looking old man slips in by a window and explains that he is a local hermit who was curious about the lamplight in the closed inn. Mary is in fact the owner's secretary, and is there to distract Kenneth to keep him from winning the bet. Kenneth learns this when he overhears her making a phone call, but assumes that all the other people are also part of the plot to distract him, which they are not. In fact, except for the hermit, they are part of a criminal gang. Eventually it becomes clear that they were to be paid $200,000 to steal a fortune in jewels from a supposed victim, who would get the jewels back and file a fraudulent insurance claim. Meanwhile, Kenneth restarts his story with the new title Three Keys to Baldpate—and, later, Five Keys to Baldpate. More of the gang arrive, and with both the jewels and the money on the inn's premises, they try to seize any opportunity to double-cross each other. When Mary tries to call the police, Cargan slips outside and cuts the telephone wire. She tries to tell Kenneth that the men are criminals, but he still assumes this is all part of the plan to distract him—until they stumble across the murdered body of one of the gang. Then they try to get away, but are unable to get past Cargan and his men. Eventually the hermit manages to go for the police, who do not entirely believe him. At the inn, they try to determine who is telling the truth; Kenneth must stall for time as Cargan holds Mary at gunpoint in an adjacent room. Eventually he manages to lead the police to the dead body and the crooks are soon arrested. But Kenneth still has to win the bet. He returns to his room and starts the story again, typing the new title Seven Keys to Baldpate—whereupon Mary kisses him warmly, and he turns back to the typewriter and immediately types "THE END".