One of my favourite features of Gmail is the ability to bookmark urls to certain messages like this:
https://mail.google.com/mail/#all/124c8f386d41fd3a
What
I think the accepted answer is incorrect (at this point, maybe it was right at the time).
If you look at the atom feed (https://gmail.google.com/gmail/feed/atom), you'll see that the entries look like this:
http://mail.google.com/mail?account_id=[EMAIL_ADDRESS]&message_id=1353f6fb621714da&view=conv&extsrc=atom
The message_id is probably the X-GM-MSGID in hex. You can retrieve the X-GM-MSGID via IMAP, so you ought to be able to contruct the URLs you want via IMAP, without using the atom feed.