Apple will officially release iPhone OS 4 tomorrow 21 Jun 2010. Will you be downloading and updating it via itunes 9.2 once it is announced or will you wait or a jailbreak available for your iPhone 3GS running OS 4 ?
If you are comfortable with 3.1.3, there is no immediate concern to update it to OS 4 unless you want multitasking. Below is a link that charts down the support compared to iPhone 4.