This is an array of ref heads, not a single one.  I think this needs to be:

        [DllImport(libgit2)]
        internal static extern int git_merge(
            out MergeResultSafeHandle git_merge_result,
            RepositorySafeHandle repo,
            [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] [In] IntPtr[] their_heads,
            int their_heads_length,
            GitMergeOptions options);