I fixed the problem. After checking most of the solutions on Drupal docs http://drupal.org/node/158043 about "WSOD" I crossed out many options.
Still, the problem was in the custom Drupal theme, more precisely in the javascript file, which is not mentioned in the previous link. After removing a part which was used for some sort of user tracking, the page started working normally.