Also, the effect is not limited to searching for spaces. Try searching for "h." and replacing with "h". And it's not just grep searches, either. Same thing happens with ordinary find/change.
The key elements seem to be: 1) The selection includes the last character of the last paragraph and 2) the Find/change reduces the length of the selected text.