Just now I found a way to make it work. I switched it the other way around, so:
$string['touser_youhaveapplied_subject'] = 'You have applied for a course {$a->coursename}';
and...
get_string('touser_youhaveapplied_subject','mod_invoicewizard', $a);
Suddenly, it works. I dont exactly know how the moodle cache purging works, but Im definitely sure that I had it like this before once and it was not working. If moodle cached my old files and I did not purge it to refresh these two lines, then that must have been the problem. So I advise to everyone to purge the cache after every file change, or make your cron for admin/cron.php to run every 15 seconds or so :D
Thanks a lot Howard, thanks to you I tried all of it again,so you basically solved my problem!
I have a question tho - if I wanted to use more properties of the object $a, how would I make it work? Because if I use the whole $a object in $string and try to get its properties in get_string then it does not work.
//EDIT: Now it works the other way around, I had to purge the cache for the old lines to disappear and after the new code is chached now, it all works as it should. So purging the cache is the final solution for this problem.