Since version 3.1 WP got much enhanced querying of custom fields. If I got the code right your query should be something like this:
query_posts(array(
'category__and' => array(1,2,3),
'meta_query' => array(
array(
'key' => 'length',
'value' => array($min_length, $max_length),
'compare' => 'BETWEEN',
'type' => 'NUMERIC',
),
),
));
See: