Check if page has subpages

You have to pass the parent page id to the wp_list_pages function instead of the global $post->ID in your subpages.

function wpse33151_getSubpages() {      
    global $post;

    $parents = get_post_ancestors($post->post_id);
    krsort($parents);
    $parents = array_merge(array(), $parents);

    if (is_home() || is_single()) {
        $id = get_option('page_for_posts');
        $parent = get_post_ancestors($id);
        $id = $parent[0];
    } elseif($parents) {
        $id = $parents[0];
    } else {
        $id = $post->ID;
    }

    $children = wp_list_pages('title_li=&child_of=" . $id . "&echo=0');
    $out = null;

    if ($children) {
        $out="<div id="subpages" class="widget-container">";
        $out .= '<h3 class="widget-title"><a href="' . get_permalink($id) . '">' . get_the_title($id) . '</a></h3>';
        $out .= '<ul>';
        $out .= $children;
        $out .= '</ul>';
        $out .= '</div>';
    }

    return $out;
}