How to retrieve “sticky” post outside the “loop”?

I am using this query;

<?php
$sticky = get_option( 'sticky_posts' ); // Get all sticky posts
rsort( $sticky ); // Sort the stickies, latest first
$sticky = array_slice( $sticky, 0, 1 ); // Number of stickies to show
query_posts( array( 'post__in' => $sticky, 'caller_get_posts' => 1 ) ); // The query

if (have_posts() ) { while ( have_posts() ) : the_post(); ?>
    <h2><a href="https://wordpress.stackexchange.com/questions/7384/<?php the_permalink() ?>"><?php the_title(); ?></a></h2>

<?php endwhile;?>
<?php } else { echo ""; }?>

Hope it works for you too.. 🙂