This is the exact issue I am dealing with on my iPhone 4. The sleep/wake button failed and I am over the 1 year warranty but under 2 years. I went to the Apple retail store only to be told by a genius on a iPad before even checking me in, that I had to pay £119 and they would replace the whole device. Or I should sign a new contract to get a new phone - a little opportunistic these "geniuses" are these days.
I insisted on speaking with the technician who basically said no, pay £119 or tough luck. When I quoted EU consumer law, he blanked out for a bit before saying that the problem had to be present on the device when I took it out the box basically. How do I prove that the button was manufactured badly and was inevitably going to fail? The only thing that I can say is that the phone is in otherwise great condition (no drops, scratches etc), and a previous iPhone 3G I had for over 2 years never had the buttons fail. Apple support weren't too helpful either and directed me back to the retail store. I think Apple don't have much experience with this. I am doubtful if Apple will honour EU law and fix the button on my iPhone.
In any case I just wanted to let you guys know my experience. Cheers.
All I can tell you is that in my case, persistence helps. I had a nightmare with my 3GS - it was replaced by apple 4 times in a little over 2 years, the 5th time I needed a replacement they offered me an iPhone 4!