Your SSD between mainboard and tray would sit insulated in a pocket of air which doesn't move. Therefore I'd say you should provide for thermal contact from the SSD to the case's motherboard tray. Depending on the width of the gap, a single layer of thermal pad may suffice, otherwise use thermal pad + metal shim + thermal pad. This all needs to fit such that you don't put mechanical stress onto the SSD; additional thermal padding between mainboard and SSD might help with this part of the problem. The tray on the other hand should of course have enough thermal contact with other parts of the case which are exposed to convection.
(All of my own M.2 SSDs don't have heatsinks, but I provided for a little bit of forced air flow around each of them. The purpose of heatsinks is to improve the boundary layer between the body to be cooled and the air which carries the heat away. In addition, heatsinks provide a little bit of thermal mass a.k.a. heat capacity, but the relevant part is that there needs to be air flow = convective heat transfer off of the heatsink.)