Login in
$imap = imap_open('{mail.google.com}INBOX', 'gmail_username', 'gmail_password');
Sort messages by date (latest first, oldest last)
$msgs = imap_sort($imap, SORTDATE, true);
Get a list of last 5 emails
$messages = imap_fetch_overview($imap, implode(',', $msgs));
Then use the $messages object to display what you want where you want.
Not 100% sure the code will work exactly as expected, but that should get you going.