Black plays and wins in 4 moves https://lichess.org/9k9UaQQz/black
1... Qxc4 2. Kf2 Qe4 3. Kg1 Qe3+ 4. Kh1 Qe1#
The analysis board does checkmate in 5 moves
1... Qxc4 2. Kxf3 Qd4 3. Ke2 Kg2 4. Ke1 Kf3 5. Kf1 Qf2#
Yes, killing the pawn was a better move.
Source:

This publication is in my collection "500 chess puzzles. Mate in 5. Advanced & Expert Level."