What happened to me once and what I speculate happened is you did not get the latch fully engaged. I think you may have engaged the latch enough to grab the pedal tab with perhaps the rounded portion of a tooth on the latch.
The loud click you heard was the pedal tab slipping off the rounded portion of the tooth and the brake pedal releasing.
I speculate you are correct.
If the braking system did not suffer a catastrophic failure, this is a reasonable explanation.
A major contributing factor was the increased forces against that partially engaged pawl, brought on by parking on a fairly steep incline.
A quick reading from the book of Fergueson, does stipulate: "When dismounting the machine for any reason", {operator}"MUST always lower all attachments, and implements to the ground", among other things. Now, we know another reason why. Although in this case, it should seem to be a very good idea to do so, without any prompting.
This does not diminish the fact that the parking brake seems to have a design defect, which allows it to be partially engaged.