drupal_static array losing values
If you look at the code for the form submission handler used for the user login form (user_login_submit()), you will notice that it executes the following code.

  global $user;
  $user = user_load($form_state['uid']);
  $form_state['redirect'] = 'user/' . $user-&gt;uid;

  user_login_finalize($form_state);


user_login_finalize() is the function that invokes the hook_user_login() implementations.

  global $user;
  watchdog('user', 'Session opened for %name.', array('%name' =&gt; $user-&gt;name));
  // Update the user table timestamp noting user has logged in.
  // This is also used to invalidate one-time login links.
  $user-&gt;login = REQUEST_TIME;
  db_update('users')
    -&gt;fields(array('login' =&gt; $user-&gt;login))
    -&gt;condition('uid', $user-&gt;uid)
    -&gt;execute();

  // Regenerate the session ID to prevent against session fixation attacks.
  // This is called before hook_user in case one of those functions fails
  // or incorrectly does a redirect which would leave the old session in place.
  drupal_session_regenerate();

  user_module_invoke('login', $edit, $user);


Effectively, the user is redirected after hook_user_login() is invoked, which means a new page is being served, and Drupal is bootstrapping once again. The content returned from drupal_static() is then reset.

The solution is saving the value in a session variable, for example using functions like ctools_object_cache_get(), and ctools_object_cache_set(), which are already available if you are using the Views module on your site, as it requires the Chaos tool suite, on Drupal 7.