I've just done this myself on El Capitan. After following the instructions and not getting anywhere, I figured out that you also have to restore com.apple.iChat. So my updated instructions are:
Firstly, you need a Time Machine backup. Time Machine is brilliant and I highly recommend everybody to have this device. If you don't have, and you have shared iMessages on your other iOS devices those deleted messages are probably there still.
In iMessage, use Preferences -> Accounts, and sign out of everything. Next, ctrl click iMessages and select Quit (two finger tap).
Open Finder, use Option -> Go (option then shows extra hidden menu option) and select Library.
Rename Messages (Message-old), and go in to Containers and rename com.apple.iChat in the same way.
Go back up and enter Time Machine (Top right side, with the clock rewinding). Pick a suitable date and restore Messages. Go back in to Containers and do the same for com.apple.iChat.
Once done, log out. Give a moment. Log back in. Open iMessages and sign in again. And for me, that was it. All done. You of course will now have lost any messages from the time the backup was made, but I'm guessing those old messages were more important.