This is done on Mac OSX Mountain Lion 10.8.3, but will work on older versions of OSX as well.
Here is the code that goes into Terminal:
defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }'
killall Dock
I know that this video is pretty short, sorry, didn't have much time when I was making it. Please leave a comment if you have a question
Osx Cool Terminal Dock Trick - Add A Recently Open Applications Icon
5 useful Terminal Commands for Mac OS X
Cool Terminal Commands
my favorite terminal tricks on mac os x
Mac Tricks 1: Terminal Tricks
Useful OSX Terminal Commands
Cool Mac Terminal Tricks
My Top 10 Terminal Hacks/Tips/Tricks on Mac OS X Lion
Tutorial - Basic Linux/Mac OSX Terminal Commands
MAC OS X Terminal Commands
simple Terminal tricks for Mac OS X
MAC Terminal Commands
Basic terminal commands (Linux/Mac/Apple TV etc)
Terminal Tutorial - Part I: Basic Commands and Concepts
Terminal Tricks In Lion
Terminal Tricks In Mac OSX
Terminal Tricks In Mountain Lion
Terminal Tricks In Leopard
Terminal Tricks In Snow Leopard
Mac OS X Dock Tricks (MacMost Now 216)
Awesome mac os x tiger dock trick!!
Awesome mac os x dock trick!!
Dock Tips and Tricks
Mac OSX Beginner Tips: The Dock
How To Customize Mac OS X The Easy Way