LastIndexOf will return the index position of your query as an integer (or returns -1 if no match is found). The Replace function asks to replace a string with a string, but what you are doing in your code is replacing an integer with a string.
I'll show you one way to do what you're looking for. It might not be the best way, and perhaps someone knows a better way, but I suggest you cut your string into 2 substrings and then join them together with your required alteration.
Here's a demo to explain what I mean:
Hope this helps.
static void Main()
String str1 = "this} is} a} test}";
ReplaceLastInstanceOf(ref str1, "}", ""); // replace the final } with nothing
static void ReplaceLastInstanceOf(ref String _str, String _old, String _new)
int i = _str.LastIndexOf(_old);
if (i > -1) // if it's -1 then there was no instances found
_str = _str.Substring(0, i) + _new + _str.Substring(i + _old.Length);