My mom just purchased an Iphone and had the same problem, showing over 2,000 unread messages, when she had none. She only uses gmail, and this is how I fixed the problem:
1) I deleted the gmail account on her Iphone.
2) I logged on to her gmail account on the computer. There I discovered she not only had an inbox, but she also had a second inbox for messages from social networks and a third inbox for promotions. I guess that all emails in gmail went to her inbox first, and then copies went to either the social email box or the promotions email box. Anyway, in gmail I went to settings -> inbox and deselected Social and Promotions. This left only the Primary box selected. I saved changes.
3) I deleted her Trash and Spam email boxes.
4) I then set up her gmail account on her iphone.
The unread message count at this point was correct and the number of emails in her gmail inbox on the iphone matched the number that showed in her gmail account on the computer.
Hope this helps.