I think the best thing you could do is to take a look at others people WP plugins and themes.
WordPress codex has a lot of info on developing plugins using ajax:
http://codex.wordpress.org/AJAX_in_Plugins
For the backend side of things, I think the best approach would be to use a custom post type for the portfolio items. Then, getting each item is a piece of cake using get_posts() or query_posts() function.
There are also some themes out there that have a portfolio system. You might check the Ozon WordPress theme, for example. It is not free, though: