i bought a new shoe assembly on eBay for like $55 and it installed in 3 minutes. That is the best way to go.
__________________________________________________________________________
Here is the info I found for the AF540 part. Note, yours will be a different part #:
www.uscamera.com
_______________________________________
Customer/Shopper ID: 72330
Date and Time: Sat May 23, 2015 01:56:54 _______________________________________
Replacement Parts for Pentax 65864-0-y83
Quantity: 1
Details: Genuine Pentax flash shoe assembly for Pentax AF 540 FGZ flash unit. 65864-0-y83
Each: $ 55.23
Item Total: $ 55.23