How can I replace an image using a Form API?
Your 'logo' variable will be a file id, referring to a row in the file_managed table, so you can use the file_load() function to load the file object, create an image with the details, and attach it to your form field.

This is a (very) basic example:

$logo = variable_get('logo');

$image = '';
if ($logo) {
  // Load the file object
  $file = file_load($logo);

  // Get a thumbnail of the image (just an example)
  $args = array('style_name' =&gt; 'thumbnail', 'path' =&gt; $file-&gt;uri, 'alt' =&gt; 'Alt text');
  $image = theme('image_style', $args);
}

// Prepend it to your field
$form['logo'] = array(
  '#title' =&gt; t('Image'),
  '#type' =&gt; 'managed_file',
  '#description' =&gt; t('Only image files will be allowed.'),
  '#default_value' =&gt; $logo,
  '#upload_location' =&gt; 'public://misc/media',
  '#upload_validators'  =&gt; array(
    'file_validate_extensions' =&gt; array('png gif jpg jpeg'),
    'file_validate_size' =&gt; array(2*1024*1024),
  ),
  '#prefix' =&gt; $image
);