Good catch!Ever notice this:
In PoA, H, H, and R hide in a room off the Great Hall before going down to Hagrid's. While in the room, they hear footsteps and then a door slam. Then silence. Then they go to Hagrid's.
Later when H and H are traveling back in time, they walk across the Great Hall, then slam a closet door shut and hide in it.
So, the first group heard the second group, but didn't know who it was.
Meanwhile, Dumbledore is "amused" when he discovers Buckbeak's escape. Another guess: Dumbledore also has a Time-Turner.