I'm afriad that Mail losing passwords is common. When you use the app specific passwords, it's a real chore to have to get new passwords when this happens.
Options. (Hopefully you wont need to do all of these.) Test after each step.
Open Keychain Access in Applications/Utilities.
1) Run Keychain First Aid. Under Keychain Access in the Menu bar select Keychain First Aid. Run First Aid.
2) Find your Gmail entries in Keychain. Look for a blue symbol with @. You can enter your account name in the top filter on right to help find all the entries.
- Open > Click on Access Control tab. Do you see Mail listed? If not click on + to add Mail.
- Next under Attributes tab, check Show password. Enter your login password and verify the password is entered. Since it's an app specific password you can only verify if it's actually entered.
3) Remove all entries for Gmail then add back in Mail to see if the new ones stick. Keychain doesn't delete old or duplicate entries. You should see one entry for sending and one for receiving. Each app will add it's own entry so if you were using Mail and another email app, you could see additional entries.
3) Create a new keychain by going to the "File" menu, then "New" and selecting "New Keychain"
You can now make this keychain your default if you desire by selecting it, then going to the "File" menu and selecting "Make '(name of keychain)' Default"
Lastly, you need to report it to Apple Feedback so it can be logged and put in the queue to be fixed.
http://www.apple.com/feedback/macosx.html