Underpromotion is not the right lesson to learn from this position. In my opinion there are at least a couple that are more valuable:
1. Don't play too quickly, always think before you make a move. You say you had 5 minutes left, that is a lot of time.
2. When your opponent only has a king, all you should think about is stalemate.
https://www.chess.com/game/live/26709589197
This was a tough one - I struggled most of this game but stayed pretty even in terms of pieces. Opponent had position and initiative for most of the game. Still I hung in there and managed to get an advantage at the end and ended up in an end game with my king and two pawns to his king. But I had bled off most of my time trying to get out of jams and only had about 5 minutes left and he had over 40.
Got my pawns in position to convert. Opponent had no way to block. I had enough time on the clock to win. Plan was to quickly promote the two pawns to queens and end it. . .
Opponent had a long think, finally moved his king in front of the second pawn. Didn't bother me because that pawn was protected by my king. Advanced the other pawn and promote it to queen and the game instantly ended. . .stalemate.
I wasn't even looking for it. He had no safe square to move to. . .If I had converted to a knight he would have been in check.
Ugh - definitely a game I should have won there. . .