couple of months back, I had the same requirement for one of my projects. I searched a bit for it and found out the following solution. This is not the only solution but I found it to one of the simpler one.
Use the webservice at http://www.webservicex.net/uszip.asmx.
Specifically GetInfoByZIP() method.
You will be able to query by any zipcode (ex: 40220) and you will have a response back as the following...
Louisville
KY
40220
502
E
Hope this helps...