If else statement based on referral URL

a $_GET variable would be the better option.

try var_dump($_GET); on the page before the conditional and see exactly what you need to test against

It seems that there is something more to the puzzle that we are missing. Is the file not showing up correctly? Could that be because the file paths are wrong? Or is it always showing the wrong image?

Also, I would say to save the image-filename as a variable based on that conditional to keep your code a little cleaner.

if ($_GET['ref'] == 'special') { 
  $file="/wp-content/uploads/2015/05/image1.gif";
} else {
  $file="/wp-content/uploads/2015/04/image2.gif";
}
?>

<div id="featured_image_small" style="background: url('<?php echo esc_url( home_url( $file ) ); ?>') no-repeat scroll 0 0 transparent; background-size:cover;">