I've been using relative paths in SharePoint masterpages the wrong way. Let's see an example of how I used to do it, with a link to the homepage and an image for the logo.
<a href="http://www.broculos.net/en" class="logo">
<img src="/Style Library/CustomStyle/Images/logo.png" alt="" />
</a>
This will work like a charm if your site collection's home URL is the same as the root of the URL, for example: http://www.example.sp2010.dev/.