Theater financier Spencer Lockridge is in his country home in his den, telling a visitor that he refuses to let anything spoil his nephew's weekend. He tells his visitor to decide is what is really important, or warns that he'll decide for him. The visitor leaves and Spencer picks up his Mad Hatter hat to go with his costume.
Ellery and a Broadway PR agent, Howard Biggers, are taking the train to the Greenhaven estate near Douglaston and arguing over who to kill in Ellery's play. The surprised conductor overhears them and assumes they're discussing a real murder. Howard and Ellery take a taxi there through the pouring rain and Ellery wonders why Spencer wants to change his book if he's so interested in using it as the basis for a new Broadway play. The detective is less than thrilled when Howard tells him that Spencer is hosting a party for his nephew, Johnny.
The butler, Doyle, greets Howard and Ellery at the door and explains that one of the guests, Gardner, couldn't find his ears. Howard says that Gardner is a rabbit, and everything becomes clear when they enter the den and find Spencer and his friends dressed as characters from Alice in Wonderland
. Emmy Reinhart, a Broadway ingénue, is playing Alice and gushes over Ellery, saying she's a big fan of his novel. Spencer's wife Laura is the Dormouse and architect Paul Gardner is the March Hare. Paul introduces his wife Diana, and Spencer's mother-in-law Letitia. She talks about how she backs Spencer's Broadway investments and her son-in-law's expense renovation of the estate. As they go to the living room for drinks, Ellery mentions his concerns about the changes to his novel. Spencer reassures him that he won't change anything important, but that Emmy is set on playing the heroine. He tells Ellery that if he wants someone else, he'll have to break the news to Emmy himself. Emmy comes in and gets Ellery to herself, and suggests that they discuss his novel later in private. He hastily excuses himself, saying that he needs sleep.
Later that night, Ellery wakes up at just after 2 a.m. Unable to get back to sleep, Ellery goes to the library to get a book and enters Spencer's den by mistake. The light switch doesn't work and he leaves, and finds Doyle with a gun. The butler explains that people have threatened Spencer's life and he also serves as a bodyguard. Ellery gets his book and Doyle leaves him. As Ellery goes upstairs, he encounters Gardner, coming down the stairs. As they talk, Emmy comes down and assumes that Ellery is tired, and goes back upstairs to bed. Gardner and Ellery wish each other good night and go to their respective bedrooms, while Doyle turns off the downstairs lights.
The next morning, Johnny comes to wake up Ellery and tell him that Spencer has taken a powder. Ellery joins the others in the library and Laura explains that her husband has disappeared and is apparently still wearing his Mad Hatter costume. Letitia gives Johnny his present as Howard comes in. The only two cars, Spencer's and Paul's, are still there, and Spencer couldn't have called a cab because the line is out due to the storm. Ellery tries to piece things together, and suggests that they fan out and search the house. They consider calling the police, but Howard warns that they don't have any reason to assume foul play. The guests split up and Ellery goes to the den. He notices a distinctive Cheshire Cat clock on the wall, steps back to the door, and turns the light on and off. He then gets up on a stool and checks the clock, as Emmy comes in. She finally gets his attention and Ellery says that someone moved the clock.
Back in the library, Ellery tells everyone that he entered the den by mistake the previous night, and he didn't see the clock in the dark. He suggests that there was an intruder who unscrewed the light and then froze in the darkness, blocking the mirror. Ellery suggests that kidnappers are responsible, and Laura argues that they shouldn't call the police because the kidnappers might harm Spencer. The detective suggests that either Spencer wandered off, he was kidnapped, or he was killed.
Once he's alone, Ellery calls his father and asks him to put out a three-state alarm for a man dressed as the Mad Hatter. The inspector reluctantly agrees. Johnny comes in and suggests that Laura hired two thugs to abduct Spencer and hold him for ransom, and then bump him off once Laura has the money. They get the ransom money and Laura inherits her husband's funds. She's also free to marry Paul, who was having an affair with her.
Laura and Paul meet and Paul tells her that he and Diana are estranged, and Spencer never loved Laura. Ellery comes out, interrupting them as Paul tries to kiss Laura. Laura goes off and Paul makes no effort to hide his affair with her from Ellery. As Paul leaves, Ellery looks out on the yard as Emmy comes out. She doesn't believe that Spencer would have gone off on his own because he has a deep fear of kidnappers. Ellery, distracted, gets an idea and goes into the house, ignoring Emmy.
Everyone gathers in the living room for coffee and Ellery suggests that they wait one more day to call the police. Emmy accuses Howard of abducting Spencer, pointing out that he's kept him on for years against his will. In response, Howard says she lost a major role because of her contract with Spencer. Emmy says that she didn't want the part anyway. Laura gets up to go and then collapses. As Howard and Paul examine her, Ellery collapses.
The next morning, Ellery wakes up and discovers that everyone else is unconscious. He makes sure that everyone is okay and then goes to the kitchen and confirms that Doyle is unconscious as well. Emmy wakes up and Ellery tells her that someone put a Mickey in the coffee. He immediately goes outside and steps on the wet lawn, and then approaches the surrounding woods. Johnny comes out and Ellery directs him away from the tree line. Johnny confirms that Doyle is a bodyguard, not a butler. When the boy keeps criticizing Ellery's detective work, Ellery gets a tree branch for a switch and Johnny makes a hasty exit.
Everyone is in the den arguing when Ellery returns. He's found an empty bottle of the phenobarbital that was used to knock them all unconscious. However, Ellery assures them that they're safe given that their attacker could have easily killed any or all of them. He asks them to wait until noon and, if Spencer or his kidnappers don't contact them, he'll contact the authorities himself. As the others go to breakfast, Ellery asks Laura where she keeps her valuables. She explains that they have just moved in and all of their valuables are in storage. However, she admits that Spencer didn't trust banks but had to use them until the large custom-made safe that he ordered had arrived. Much to Laura's surprise, Ellery accurately describes the exact dimensions of the house. When he asks where Spencer was going to put it, Laura admits that she had no idea. Once she leaves, Ellery makes a phone call.
Inspector Queen receives a report from his secretary, Grace, that there's been no success finding Spencer. He asks her to contact Velie, but Grace admits that Velie logged out despite the fact that he's on-duty. Inspector Queen irritable tells her to contact Inspector Carr from the 115th precinct.
Ellery talks to Doyle, who claims to have no idea what happened to Spencer. The sleuth observes that Spencer was Doyle's responsibility, but Doyle feigns ignorance. Emmy comes in and tells Ellery that Spencer wasn't kidnapped. She asks Ellery if Spencer is dead, but before he can answer, the doorbell rings. Diana goes to the front door and finds a package addressed to Laura. She opens it and finds a pair of Spencer's shoes. However, they weren't the ones that he was wearing the night he disappeared.
As they examine the shoes, there's a knock at the rear door. Doyle finds a package sitting on the stoop. It's addressed to Emmy and inside are two model ships, gifts that Howard gave to Johnny for Christmas. Letitia insists that Johnny has been in his room all morning and couldn't be responsible. Ellery notes that both of the objects came from inside the house, but were found outside. They split up to search the house, and Ellery and Emmy find an envelope addressed to Letitia. However, the envelope is empty. Laura realizes that it's her stationery, and the wax seal on it is her own as well. She takes them to the writing desk in the living room to show them, and confirms that someone has stolen her stationery and wax.
Laura wants to call the police, but Ellery spots his father and Inspector Carr pulling up the drive. Ellery explains that he called them in unofficially and invites them in. Before he can explain, Howard finds a basket on the porch, addressed to Paul, which holds two heads of cabbage. Ellery calls everyone into the library and sums up what they've found: shoes, ships, sealing wax, and cabbages. Carr thinks that Spencer is playing some kind of joke. Inspector Queen pulls Ellery to the side and asks for an explanation, and wonders where Velie is. Ellery tells him to wait, and a rock comes through the window. It's addressed to Laura, and has two chess pieces, the white and black kings, attached to it. Everyone starts arguing except Emmy, who notices that Ellery has slipped out to the study. He closes the door, says that he's setting up some chairs for a performance, and reluctantly tells her that Spencer is dead. Emmy admits that she cared for Spencer, who was the only person who ever gave her a chance, and Ellery asks her not to say anything. When she agrees, he has her invite the others into the study.
Once everyone has assembled, Ellery tells Laura and the others that Spencer is dead. He then explains that he originally believed that someone had moved the cat, which is why he didn't see its glowing numbers in the dark. However, he has another theory. When Howard points out that Ellery suspected that the intruder hid and blocked the mirror, Ellery points out that the killer would have had to be 7' tall. That leaves one other possibility: the mirror was moved. Letitia points out that it's impossible to move a mirror that large, and Ellery agrees. He then notes that someone was trying to get them to focus on something in particular and analyzes the clues: shoes, ships, sealing wax, cabbages, and kings. Those are items in a line from Alice in Wonderland
: "The time has come, the Walrus said, to speak of many things. Of shoes and ships, of sealing wax, of cabbages and kings." Emmy recognizes the line, and Ellery points out that it's actually from Carroll's sequel, Through the Looking Glass, and What Alice Found There. Ellery goes to the mirror and activates a catch, and the glass slides to reveal a hidden compartment and the figure of the Mad Hatter, dead. Paul breaks down and says that he buried Spencer out by the south gate. Ellery thanks him for the confession and asks Velie to step out. The sergeant, dressed in the Mad Hatter's costume, steps out.
Later, Ellery, Inspector Queen, and Emmy are returning to New York by train. He explains that when he saw a sundial on the yard, it reminded him of the clock and the mirror. He checked the mirror and found the secret compartment for the safe. Ellery had no evidence, but realized that only Paul, who renovated the house, would have known about the compartment. Paul killed Spencer, hid the body in the compartment in the study, and heard Ellery come in. The architect froze in the dark, then slipped out, made it to the stairs, and pretended he was coming downstairs when he met Ellery. Since it was raining out, Paul couldn't dispose of the body permanently without coming in soaking wet. He then drugged the coffee and buried the body while everyone else was unconscious. He couldn't find the body on the grounds, so he called in Velie and staged the Lewis Carroll gifts to trick Paul into revealing himself. As Ellery talks about the murder, and the one he wrote for his novel, the conductor overhears him again and beats a hasty retreat.