You will need to get the current day by calling GetDay and then break up today's date into its various components, subtract the appropriate number from the day component and set the date back using the all other components and the updated Day component. It should calculate the date correctly.
Did you try to run the code in debugger to see what causes InfoPath to lock up?
Shanthi
InfoPath Dev India
Shanthi Reddy