Hermione reveals to Harry that she was entrusted with a time-travelling device called a Time-Turner, which is how she was able to attend so many classes. Prompted by Dumbledore, she and Harry travel three hours into the past, watching themselves go through the night's previous events. They set Buckbeak free and return to the Whomping Willow. As the Dementors are about to attack the "other" Harry and Black, Harry realizes that the mysterious figure he saw earlier was actually himself. Armed with the new memory of his talk with Black, he casts the powerful Patronus that repels the Dementors. Harry and Hermione free Black, who escapes on Buckbeak as the two return to Dumbledore and resume their normal timeline.
Remus Lupin resigns as an angry Severus Snape, who has a childhood grudge against the Marauders, tells the whole of Slytherin House that Lupin is a werewolf. After Harry says good-bye to Lupin, Dumbledore tells Harry that Pettigrew is now in his debt, a fact for which he may one day be grateful. He also tells Harry that "all four Marauders were on school grounds tonight" and says that James Potter lives in Harry.