Show attached media image if no thumbnail image detected

If you want to use get_attached_media(), you can try for example:

if( has_post_thumbnail() )
{
    the_post_thumbnail();
}
else
{
    $imgs = get_attached_media( 'image' );

    if( count( $imgs ) > 0 )
    {
        $img = array_shift( $imgs );
        echo wp_get_attachment_image( $img->ID, 'thumbnail' );
    }
}

to display one of the attached images, if there’s no featured image available for the current post.

Notice that you can’t use echo to show the content of an array, only for a scalar variable.