After several hours, I believe I've found the solution to the 1,000's of unread emails showing up in the iPhone badge app from GMAIL after upgrading to iOS7. Turns out the problem, at least for me, was with Gmail. Fix is the following:
1) Go to full site for Gmail on a computer and type in the following in the Gmail search field "is:unread" - without the quotes.
2) Then click on drop down arrow under the search field and click on "All".
3) Then go to middle of screen and click on "Select all conversations that match this search".
4) Then go to the More button under the search field and click on "Mark as read"
5) You will then receive a warning sign and click OK.
GMAIL will then process all the mail in your account from the beginning date you set it up and mark everything as read. When you next log on to your iPhone mail account it will refresh and show no unread emails in your inbox and only when new emails arrive will the count begin again. Hope this helps.