diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 795646d08e556394af740582e37161344bdc740f..238c6c4bcf1297d5d8a20707022803ebd6a10638 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -1139,7 +1139,9 @@ class Formula
       tab = Tab.for_keg(keg)
       next if version_scheme > tab.version_scheme
       next if version_scheme == tab.version_scheme && pkg_version > version
-      next if follow_installed_alias? && installed_alias_target_changed?
+
+      # don't consider this keg current if there's a newer formula available
+      next if follow_installed_alias? && new_formula_available?
 
       return [] # this keg is the current version of the formula, so it's not outdated
     end
@@ -1157,6 +1159,10 @@ class Formula
     end
   end
 
+  def new_formula_available?
+    installed_alias_target_changed? && !latest_formula.installed?
+  end
+
   def current_installed_alias_target
     Formulary.factory(installed_alias_path) if installed_alias_path
   end
diff --git a/Library/Homebrew/test/test_formula.rb b/Library/Homebrew/test/test_formula.rb
index 3a021b4f6d495c75b41ecfae2ea652fc632dbfd4..9f39dd2d096faa1f55b488043a99f286fb892717 100644
--- a/Library/Homebrew/test/test_formula.rb
+++ b/Library/Homebrew/test/test_formula.rb
@@ -851,7 +851,7 @@ class OutdatedVersionsTests < Homebrew::TestCase
               :greater_prefix,
               :head_prefix,
               :old_alias_target_prefix
-  attr_reader :f, :old_formula
+  attr_reader :f, :old_formula, :new_formula
 
   def setup
     @f = formula do
@@ -860,6 +860,7 @@ class OutdatedVersionsTests < Homebrew::TestCase
     end
 
     @old_formula = formula("foo@1") { url "foo-1.0" }
+    @new_formula = formula("foo@2") { url "foo-2.0" }
 
     @outdated_prefix = HOMEBREW_CELLAR/"#{f.name}/1.11"
     @same_prefix = HOMEBREW_CELLAR/"#{f.name}/1.20"
@@ -869,7 +870,8 @@ class OutdatedVersionsTests < Homebrew::TestCase
   end
 
   def teardown
-    [@f.rack, @old_formula.rack].select(&:exist?).each(&:rmtree)
+    formulae = [@f, @old_formula, @new_formula]
+    formulae.map(&:rack).select(&:exist?).each(&:rmtree)
   end
 
   def alias_path
@@ -921,13 +923,21 @@ class OutdatedVersionsTests < Homebrew::TestCase
     assert_predicate f.outdated_kegs, :empty?
   end
 
-  def test_outdated_follow_alias_and_alias_changed
+  def test_outdated_follow_alias_and_alias_changed_and_new_target_not_installed
     f.follow_installed_alias = true
     f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
-    stub_formula_loader(formula("foo@2") { url "foo-2.0" }, alias_path)
+    stub_formula_loader(new_formula, alias_path)
     refute_predicate f.outdated_kegs, :empty?
   end
 
+  def test_outdated_follow_alias_and_alias_changed_and_new_target_installed
+    f.follow_installed_alias = true
+    f.build = setup_tab_for_prefix(same_prefix, path: alias_path)
+    stub_formula_loader(new_formula, alias_path)
+    setup_tab_for_prefix(new_formula.prefix) # install new_formula
+    assert_predicate f.outdated_kegs, :empty?
+  end
+
   def test_outdated_no_follow_alias_and_alias_unchanged
     f.follow_installed_alias = false
     f.build = setup_tab_for_prefix(same_prefix, path: alias_path)