This bug has been present since I started using HeidiSQL and finally took the time to report it after seeing it hasn't been fixed.
If the SSH tunnel is closed for being time out, suspending the computer, network problems or any other reason with the Data Tab opened, and another table is clicked in order to show it's data, even though HeidiSQL tries to stablish a new plink right away, it does not wait for the link to be established (I assume) and results in a Exception.
There are other cases where this happens as well, not only when in Data tab but that's easiest way to reproduce it. If necessary I can explain the other cases, which is related to retrieving a table's columns with the query auto completion and suggestion dialog.
Attached bugreport.txt