I just committed a very early initial implementation of "imapc" storage backend to v2.1 hg: http://hg.dovecot.org/dovecot-2.1
You can't really do anything except open INBOX and read mails from it, so it's currently only intended for initial testing. It sucks in many ways right now, but I'll be improving it.
The idea is that you could set for example:
mail_location = imapc:imap.gmail.com
And then Dovecot could act as a proxy to gmail. It won't actually work currently with gmail, because there's no SSL support for outgoing connections.
Currently index files are forcibly disabled, but it would be easy to enable them, allowing Dovecot to do caching locally to improve performance. In future perhaps it will also support caching message headers/bodies to avoid unnecessary traffic.
Besides the mail_location setting, you'll need to also forward the user's password to imap process in "pass" userdb extra field. How to do that depends on what passdb/userdb you're using. While testing you could simply set a static password:
plugin { pass = yourpassword }