Get nid inside preprocess function
From another implementation of the same hook I found out that the node is actually available through the following. Try it out. 

  $node = $variables['node'];


From there you can get node id.