The error you are getting makes sense, I forgot to mention that part. The shipping server behavior is still being triggered and the value that it is trying to use for the service type is not valid.
To account for this you will need to add in a condition to the if statement that serves as the trigger for the shipping server behavior or add in a new if statement around the server behavior. The if statement will be like this:
<?php if( !(isset($_SESSION["flat_shipping"])) ) { ?>
// your UPS shipping quote server behavior here
<?php } ?>
As for the issue with the value not being retained in the cart object after you edit it to be correct try closing down DW and opening it again to determine if the problem persists, let us know what you find.