Cannot reset a loop in a plugin template

Your question is incomplete and you have omitted all the context for some weird reason.

I hope we agree that query_posts() is a bad idea. There’s enough been said on it:

When to use WP_query(), query_posts() and pre_get_posts

Having said that, have you tried wp_reset_postdata, wp_reset_query or rewind_posts? I have no idea what you are doing here, but you can read this and figure which one to use:

http://digwp.com/2011/09/3-ways-to-reset-the-wordpress-loop/