You're definitely right that Miles heard it from beyond the grave; she didn't say it to Sawyer.

That could totally be the case with that conversation, now that you mention it, but it's not how I interpreted it. I think I'd actually be more disappointed if that was their intention — not only was it just a fake-out, but this is how we're justifying it, he's hearing bits of a different scene. I kind of like it better if that scene at the vending machines was just written as a call-back/parallel, and the whole business with "it worked" was just an idea for a bigger plotline that didn't go anywhere.