I would suggest something like:
fun! SubstiTute()
let l = 1
let limit = line('$')
while l < limit
call setline(l, substitute(getline(l), 'this', 'that' , 'gc'))
let l = l + 1
endwhile
endfun
Using setline() in conjunction with substitute() your jumplist and changelist will not be messed up.