How can I insert one bespoke item first and one last in a views grid?
Go to admin/structure/views/view/YOUR-VIEWS-NAME/edit/page, click on Theme:Information and you will see bunch of lines. Choose appropriate one depending what exactly you want to override. It can be the whole views display output, or style output, or specific field output. 

Each line will have an active hyperlink, clicking which you can copy the content of the new file. Also each line will have file name suggestions.
When you identified the right output, you can choose pick any of the suggested file names on that line: the further to the right, the more specific output. 

Create a new template file in your themes template directory, paste the copied content and start modifying the output per your desire.

For example, you could execute your checks just after foreach loop starts:

&lt;?php foreach ($rows as $row_number =&gt; $columns): 
  if ($row_number != 0) {
    // Here goes your custom modifications.
  }
&lt;?php endforeach; ?&gt;