Originally posted by savoche I'm with Class A (especially the P.S.). Unless there is something "wrong" with the K-5 that the K-3 can fix I'd go for the lens first.
If you're guy like me, chasing hummingbirds and other small birds, the improved AF is to die for. The K-3 has slightly less dynamic range, the ability to expose for highlights and rescuing serviceable detail from the shadows, is not a trait of the K-3 sensor. Even though the range is theoretically about the same, it seems to me the shadow end of the K-5s dynamic range is better than the K-3s.
The added resolution of the K-3 is enough to give you more resolution from an 18-135 than you'd get with any lens you can name on a K-5.
That being said... there's nothing wrong with the IQ of a K-5 and the noise is about the same... so functionally they have about the same low light capability. (but at 100 ISO, the K-3 is noticeably better).
It's a all conundrum... for me, it's all about the 27 focus points, and more ability to crop, while maintaining resolution. I use selective focus on almost every flower shot and macro. I can crop 20% of my K-3 image and still have enough resolution to print an image like a K-5 image, printed full size.
But honestly, I see no need to have another K-3 as a back up. If something happens to the K-3, I'll do fine with the K-5.