Check out this video at the end of it you see exactly when Rumpelstiltskin got his memories back. As far as how he procured Henry that’s the big mystery. Pinocchio may have had a hand in it some how Henry got from a prison in Phoenix to the town of Storybrooke without Mr. Gold being able to leave the town. The thing to remember is also that Mr. Gold didn’t recognize Pinocchio so maybe it wasn’t a direct exchange between them? The only other thing we haven’t seen much of is if the Blue Fairy had her memories the whole time maybe she was colluding with Pinocchio or had some kind of contact with him. She mentioned final preparations at one point so those preparations could have ment finding out some way to keep her memories and maybe create the book.