You see, thats why you should check the first 3-4 and last 3-4 characters of a string when you're manually comparing them! You quite clearly told me that they matched so I ruled that out as being the problem and was looking at other things.
Now you've learned how to debug a bit better dumping stuff and examining it in detail I think you deserve a pat on the back
Well done
The only thing that does worry me.. how do you know the rest of the accounts haven't suffered the same fate? - You need to check them and make sure they're all 40 characters too.
As for giving up, I did that a few years ago on one project I was working on in delphi. It was a string termination error in a socket server I was writing. I couldn't nail the fault and gave up after many desk thumping moments. 2 years later I revisited it trying to decide wether to delete the project dir or not. Opened it up and the fault was glaring me in the face. Just goes to show that giving up isn't always necessary but taking a break can be a good thing
Still, you saved yourself some money - had you of taken me up on my offer that minimum 1hr of £20 would of been wasted - I'd have identified that fault within 5 - 10 mins!