Index: src/wp-includes/wp-db.php
===================================================================
--- src/wp-includes/wp-db.php	(revision 39199)
+++ src/wp-includes/wp-db.php	(working copy)
@@ -3041,8 +3041,8 @@
 		if ( preg_match( '/^\s*(?:'
 				. 'SHOW\s+TABLE\s+STATUS.+(?:LIKE\s+|WHERE\s+Name\s*=\s*)'
 				. '|SHOW\s+(?:FULL\s+)?TABLES.+(?:LIKE\s+|WHERE\s+Name\s*=\s*)'
-				. ')\W((?:[0-9a-zA-Z$_.`-]|[\xC2-\xDF][\x80-\xBF])+)\W/is', $query, $maybe ) ) {
-			return str_replace( '`', '', $maybe[1] );
+				. ')\W((?:\\\\_|[0-9a-zA-Z$_.`-]|[\xC2-\xDF][\x80-\xBF])+)\W/is', $query, $maybe ) ) {
+			return str_replace( array( '`', '\\_' ), array( '', '_' ), $maybe[1] );
 		}
 
 		// Big pattern for the rest of the table-related queries.
Index: tests/phpunit/tests/db.php
===================================================================
--- tests/phpunit/tests/db.php	(revision 39199)
+++ tests/phpunit/tests/db.php	(working copy)
@@ -671,6 +671,16 @@
 	}
 
 	/**
+	 * @ticket 38751
+	 */
+	function test_get_escaped_table_from_show_query() {
+		$query = "SHOW TABLES LIKE 'wp\_123\_foo'";
+		$expected = 'wp_123_foo';
+
+		$this->assertEquals( $expected, self::$_wpdb->get_table_from_query( $query ) );
+	}
+
+	/**
 	 * @ticket 21212
 	 */
 	function data_process_field_formats() {
