As far as I can tell, the only way to do this reliably is with mod_rewrite, as Dave showed above. I would just alter that code slightly so that it should work for any page on your site. I think the following should work:
Code:
RewriteCond %{QUERY_STRING} ref=pislikcs.com
RewriteRule ^(.*).html$ http://example.com/%1.html [R=301,L]
This should take the entire URL up to the .html extension and replace it in a redirect without a query string. The rewriteCond directive should ensure this is only done for ref=pislikcs.com so that other query strings on your site will still work.