Index: src/wp-includes/ms-functions.php
===================================================================
--- src/wp-includes/ms-functions.php	(revision 40364)
+++ src/wp-includes/ms-functions.php	(working copy)
@@ -109,15 +109,14 @@
  * The count is cached and updated twice daily. This is not a live count.
  *
  * @since MU 1.0
+ * @since 3.7.0 The $network_id parameter has been deprecated.
+ * @since 4.8.0 The $network_id parameter is now being used.
  *
- * @param int $network_id Deprecated, not supported.
- * @return int
+ * @param int|null $network_id ID of the network. Default is the current network.
+ * @return int Number of active sites on the network.
  */
-function get_blog_count( $network_id = 0 ) {
-	if ( func_num_args() )
-		_deprecated_argument( __FUNCTION__, '3.1.0' );
-
-	return get_site_option( 'blog_count' );
+function get_blog_count( $network_id = null ) {
+	return get_network_option( $network_id, 'blog_count' );
 }
 
 /**
Index: tests/phpunit/tests/multisite/network.php
===================================================================
--- tests/phpunit/tests/multisite/network.php	(revision 40364)
+++ tests/phpunit/tests/multisite/network.php	(working copy)
@@ -12,6 +12,9 @@
 	protected $plugin_hook_count = 0;
 	protected $suppress = false;
 
+	protected static $different_network_id;
+	protected static $different_site_ids = array();
+
 	function setUp() {
 		global $wpdb;
 		parent::setUp();
@@ -25,6 +28,33 @@
 		parent::tearDown();
 	}
 
+	public static function wpSetUpBeforeClass( $factory ) {
+		self::$different_network_id = $factory->network->create( array( 'domain' => 'wordpress.org', 'path' => '/' ) );
+
+		$sites = array(
+			array( 'domain' => 'wordpress.org', 'path' => '/',     'site_id' => self::$different_network_id ),
+			array( 'domain' => 'wordpress.org', 'path' => '/foo/', 'site_id' => self::$different_network_id ),
+			array( 'domain' => 'wordpress.org', 'path' => '/bar/', 'site_id' => self::$different_network_id ),
+		);
+
+		foreach ( $sites as $site ) {
+			self::$different_site_ids[] = $factory->blog->create( $site );
+		}
+	}
+
+	public static function wpTearDownAfterClass() {
+		global $wpdb;
+
+		foreach( self::$different_site_ids as $id ) {
+			wpmu_delete_blog( $id, true );
+		}
+
+		$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->sitemeta} WHERE site_id = %d", self::$different_network_id ) );
+		$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->site} WHERE id= %d", self::$different_network_id ) );
+
+		wp_update_network_site_counts();
+	}
+
 	/**
 	 * By default, only one network exists and has a network ID of 1.
 	 */
@@ -66,15 +96,14 @@
 	function test_get_main_network_id_after_network_delete() {
 		global $wpdb, $current_site;
 
-		$id = self::factory()->network->create();
-		$temp_id = $id + 1;
+		$temp_id = self::$different_network_id + 1;
 
-		$current_site->id = (int) $id;
+		$current_site->id = (int) self::$different_network_id;
 		$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->site} SET id=%d WHERE id=1", $temp_id ) );
 		$main_network_id = get_main_network_id();
 		$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->site} SET id=1 WHERE id=%d", $temp_id ) );
 
-		$this->assertEquals( $id, $main_network_id );
+		$this->assertEquals( self::$different_network_id, $main_network_id );
 	}
 
 	function test_get_main_network_id_filtered() {
@@ -157,6 +186,26 @@
 	}
 
 	/**
+	 * @ticket 37865
+	 */
+	public function test_get_blog_count_on_different_network() {
+		global $current_site, $wpdb;
+
+		// switch_to_network()...
+		$orig_network_id = $current_site->id;
+		$orig_wpdb_network_id = $wpdb->siteid;
+		$current_site->id = self::$different_network_id;
+		$wpdb->siteid = self::$different_network_id;
+		wp_update_network_site_counts();
+		$current_site->id = $orig_network_id;
+		$wpdb->siteid = $orig_wpdb_network_id;
+
+		$site_count = get_blog_count( self::$different_network_id );
+
+		$this->assertSame( count( self::$different_site_ids ), $site_count );
+	}
+
+	/**
 	 * @ticket 22917
 	 */
 	function test_enable_live_network_user_counts_filter() {
