Get post ids sorted by meta_key

It’s easy. 🙂 You would use get_posts function. See WP_Query class for complete list of parameters that you can use.

function get_posts_by_view_count() {
$ids = array();

$args = array(
    'orderby'   =>  'meta_value_num',
    'order'     =>  'DESC',
    'meta_key'  =>  'post_view_count'
);  
$posts = get_posts( $args );

if( $posts ) {
    foreach( $posts as $post ) {
        $ids[] = $post->ID;
    }
}

return $ids;
}