You could add a column to your cart object to hold the shipping price and use the subtotal of this column in a custom shipping charge rule. You would need to add in a check for the quantity to make sure it is not more than 4. You would then need to make another flat rate rule that would check to see if there were more than 4 and if so apply the flat rate.
The shipping quote charges that you see in the cart are a result of the shipping quote server behavior. This server behavior is usually only applied to the confirm page, so if you add another item to the cart it will not update the shipping until you get to the confirm page.