Change published status directly in database
You also need to change the status column in the node_revision table:

foreach (array('node', 'node_revision') as $table) {
  db_update($table)
    -&gt;fields(array('status' =&gt; 0))
    -&gt;condition('nid', $nid)
    -&gt;execute();
}


Notwithstanding any aggressive caching you might have in place, the effect should be immediate once you've run both those queries.

Drupal has plenty of these little nuances, which is why it's highly recommended to use the API functions rather than manipulating the database directly. Yes there's extra overhead, but you don't need to give things like the revisions table/caching a second thought as they're handled for you.