the first time it was Harry(when he and Hermione used the time turner in Prisoner of Azkaban) and the seconde time I believe it was Snape (when we see him talking with Dumbledore through the pensieve that Snape's patronus is the same as Lily Potter's
The Patronus which led Harry to where Gryffindor's sword was hidden had been cast door Snape. Lily had a doe-formed Patronus, and Snape's Patronus had shifted to mimic hers because of his love for her and his guilt over her death. Possibly Harry subconsciously recognised the form, which is why he trusted the Patronus and followed it. In one of Snape's memories, we later see him tonen Dumbledore that his Patronus is still doe-formed as a way of proving that Lily is still his motivation.