What if you replace this line with, for example: `margin-bottom: 5px;` and then add the following rule below:
```
#thumbnailView > a:last-of-type > .thumbnail {
  margin-bottom: 10px;
}
```
This way you should be able to fix the spacing after the last thumbnail without a single line of JS code.