There's no way around this because of the global box-sizing: border-box. Padding affects the height of the element, so when the collapsing element goes from whatever height it's at to height: 0, it has the padding in there. Then the display: none; kicks in and it skips out of view.
putting a div around that element and collapsing that instead fixes that in most cases, but you could solve this issue really easy by just using .css( "height" ) rather than .height(). http://api.jquery.com/height/
+1 for fixing