The Bark Bites Back at 2012-04-25 10:33:57:
If I remember correctly, the Healy scene comes before Ted's scene. There's actually a nice intercut back and forth leading up to Ted's moment in the bathroom.
The reason for the change? Momentum.
Cutting from Mary placing the gel into her hair to the immediate scene of Ted's reaction while they're in a restaurant keeps the momentum, and audience, laughing. I don't know what the actual term would be called, but it gives the audience one last round of guffaws.
If you're familiar with the show Mrs. Brown's Boys, you may have seen this hilarious clip. The same thing is done at about the 4:04 mark. Just when the audience is at the peak of their laughter, the scene ends/cuts to the next one and the laughter subsides momentarily, but the tag scene continues the predicament, starting another round of laughter.
That's sustainability!
Here's a link to the scene:
http://www.ebaumsworld.com/video/watch/81447597/