I disagree with the "ask first" suggestion. That's adding friction to the process that makes it less organic and will disincentivize actually doing it. Instead I will give feedback that I know won't hurt the employee I'm praising. There is an art to writing this stuff - usually making it more about yourself and how your problems are easier.
Asking first makes sense because they may have been told by their manager to deprioritize or stop working on whatever your problem was, but they used their judgement and helped you anyway. Praising them in front of others undermines that directive, and even if their manager was ok with them helping you in this one off situation they may not want to advertise "Go to John for help with X". You hear stories of employees…
Also - I'm not necessarily advocating for praising in front of others in every case. In some cases that makes sense, in some cases it makes sense just to send a message to the manager directly.