I'm afraid this won't work in detached HEAD mode.

**Update:** I've worked a bit on this. How about the following

```diff
diff --git a/LibGit2Sharp.Tests/MergeFixture.cs b/LibGit2Sharp.Tests/MergeFixture.cs
index 8a9976e..2867b9e 100644
--- a/LibGit2Sharp.Tests/MergeFixture.cs
+++ b/LibGit2Sharp.Tests/MergeFixture.cs
@@ -1,7 +1,7 @@
-﻿using System;
-using System.Linq;
+﻿using System.Linq;
 using LibGit2Sharp.Tests.TestHelpers;
 using Xunit;
+using Xunit.Extensions;
 
 namespace LibGit2Sharp.Tests
 {
@@ -143,8 +143,10 @@ public void IsUpToDateMerge()
             }
         }
 
-        [Fact]
-        public void CanFastForwardRepos()
+        [Theory]
+        [InlineData(true)]
+        [InlineData(false)]
+        public void CanFastForwardRepos(bool shouldMergeOccurInDetachedHeadState)
         {
             const string firstBranchFileName = "first branch file.txt";
             const string sharedBranchFileName = "first+second branch file.txt";
@@ -171,12 +173,28 @@ public void CanFastForwardRepos()
 
                 secondBranch.Checkout();
 
+                if (shouldMergeOccurInDetachedHeadState)
+                {
+                    // Detaches HEAD
+                    repo.Checkout(repo.Head.Tip);
+                }
+
+                Assert.Equal(shouldMergeOccurInDetachedHeadState, repo.Info.IsHeadDetached);
+
                 MergeResult mergeResult = repo.Merge(repo.Branches["FirstBranch"].Tip, Constants.Signature);
 
                 Assert.Equal(MergeStatus.FastForward, mergeResult.Status); 
-                Assert.Equal(repo.Branches["SecondBranch"].Tip, mergeResult.Commit);
-                Assert.Equal(repo.Branches["SecondBranch"].Tip, repo.Head.Tip);
+                Assert.Equal(repo.Head.Tip, mergeResult.Commit);
+
                 Assert.Equal(0, repo.Index.RetrieveStatus().Count());
+                Assert.Equal(shouldMergeOccurInDetachedHeadState, repo.Info.IsHeadDetached);
+
+                if (!shouldMergeOccurInDetachedHeadState)
+                {
+                    // Ensure HEAD is still attached and points to SecondBranch
+                    Assert.Equal(repo.Refs.Head.TargetIdentifier, secondBranch.CanonicalName);
+                }
+
             }
         }
diff --git a/LibGit2Sharp/Repository.cs b/LibGit2Sharp/Repository.cs
index 621c522..7854e8c 100644
--- a/LibGit2Sharp/Repository.cs
+++ b/LibGit2Sharp/Repository.cs
@@ -1101,7 +1101,9 @@ private void FastForward(Commit fastForwardCommit)
 
             CheckoutTree(fastForwardCommit.Tree, null, checkoutOpts);
 
-            Refs.UpdateTarget(this.Head.CanonicalName, fastForwardCommit.Id.Sha);
+            var reference = Refs.Head.ResolveToDirectReference();
+
+            Refs.UpdateTarget(reference, fastForwardCommit.Id.Sha);
 
             // TODO: Update Reflog...
         }
```