It is possible to encounter horrible bugs if I place a main loop that uses `query_posts` right above the main bbPress loop?

This is the code:

            <?php get_template_part( 'pagination', 'bbp_replies' ); ?>

            <?php query_posts('gdsr_sort=thumbs&post_type=bbp_reply&posts_per_page=2'); ?>
            <?php while ( have_posts() ) : the_post(); ?>
                <h2><?php  the_title(); ?></h2>
                <?php the_content(); ?>
            <?php endwhile; ?>
            <?php wp_reset_query(); ?>

            <?php while ( bbp_replies() ) : bbp_the_reply(); ?>

                <div class="topic-entry">

                    <div class="topic-author">
                        <?php bbp_reply_author_link( array( 'type' => 'avatar' ) ); ?>
                        <?php bbp_reply_author_link( array( 'type' => 'name' ) ); ?>
                        <?php printf( __( '%1$s', 'bbpress' ), get_the_date() ); ?>
                    </div>

                    <div class="topic-content">
                        <?php bbp_reply_content(); ?>
                        <span class="like-counter"><?php DisplayVotes(get_the_ID()); ?></span>
                    </div>

                        <?php bbp_reply_admin_links(); ?>

                    </div>

The first query_posts loop list the 2 most voted replies. The second bbPress loop list all other replies in DESC order.

Will I encounter bugs if I have these two loops in a same file template?

Solutions Collecting From Web of "It is possible to encounter horrible bugs if I place a main loop that uses `query_posts` right above the main bbPress loop?"

I would not do it this way, but it should not be a problem. When your template file is executed the “real main loop” already contains the posts for this page. You then execute query_posts() to do a second query, which “hides” the “real” loop, but after you are done you execute wp_reset_query() which makes the “real” loop again the active loop.

It would get confusing and lead to errors if you would embed the two loops, thus if you executed another query_posts() in that main where loop. Then you must use get_posts() or a direct WP_Query to prevent errors.

Personally, I never call query_posts() myself and always use get_posts(), because it doesn’t change any global variables “behind my back”.