Anthony McDonald double puts Hearts in next round
McDonald gave the Jambos a second-half lead at Oriam, firing home a right-footed shot.
With 15 minutes left, Aidan Fitzpatrick levelled the tie with a stunning strike.
Thistle were reduced to ten men when Max Melbourne was red-carded for violent conduct.
McDonald won the tie for Hearts in injury time, slamming the ball home from six yards.
Hearts: Mason, Logan, Gajda (Strang, 86), Petkov, Hickey (Zanatta, 66), Ritchie, McGill, McDonald, Smith, Moore, Makovora (Henderson, 57). Subs: Silva, Leddie.